一、获取模型的参数
1.
//m_Man.m_CurMdl.m_tSld.GetAttr();
//ZwComponentUserAttributeGet(m_Man.m_CurMdl.m_tSld.);
szwUserAttribute *attributeList=NULL;
int nCount;
ZwUserAttributeGet(NULL, &nCount, &attributeList);
for (int i = 0; i < nCount;i++)
{
szwUserAttribute* aaa = &attributeList[i];
if (aaa==nullptr)
{
continue;
}
wxString str = aaa->name;
}
//for (int i = 0; i < nCount; i++)
//{
// ZwMemoryFree((void**)&attributeList[i]);
//}
ZwMemoryFree((void**)attributeList);
2.
THND(TkbParam) param=m_Man.m_CurMdl.m_tSld.GetParamMng();
TbaStringArray arrParam;
param.get()->GetAllParam(arrParam);
for (int i=0;i<arrParam.size();i++)
{
wxString strParamName = arrParam[i];
if (strParamName.IsEmpty())
{
continue;
}
sDriveParam *sDParam=new sDriveParam;
sDParam->m_strParamName = strParamName;
eTkbVarParamType pType=param.get()->GetParType(strParamName);
sDParam->m_eParamType = pType;
sDParam->GetParamTypeStr();
sDParam->m_strVal = sDParam->GetParamVal(m_Man.m_CurMdl.m_tSld);
m_Man.m_CurMdl.m_vDriveParam.push_back(sDParam);
}
二、获取模型的变量
bool ThkFsatDesDeriveParamDlg::ReadVariable()
{
int nCount = 0;
szwVariableData* arrData;
ezwErrors err= ZwVariableListGet(NULL,&nCount,&arrData);
for (int i=0;i<nCount;i++)
{
szwVariableData* pData = &arrData[i];
if (pData==nullptr)
{
continue;
}
sDriveParam* sDParam = new sDriveParam;
sDParam->m_strParamName = pData->name;
sDParam->m_strVal = pData->expression;
sDParam->m_strDescripte = pData->description;
sDParam->m_eVariableType = pData->type;
sDParam->m_IsVariable = true;
m_Man.m_CurMdl.m_vDriveParam.push_back(sDParam);
}
ZwMemoryFree((void**)&arrData);
return true;
}
2.修改模型变量的值
bool ThkFastDesMdlCreateMng::EditDruveParamVal()
{
int nCount = 0;
szwVariableData* arrData;
ezwErrors err = ZwVariableListGet(NULL, &nCount, &arrData);
for (int j=0;j<m_vDriveParam.size();j++)
{
sDriveParam* pParam = m_vDriveParam[j];
if (pParam==nullptr)
{
continue;
}
for (int i = 0; i < nCount; i++)
{
szwVariableData* pData = &arrData[i];
if (pData == nullptr)
{
continue;
}
if (pParam->m_strParamName.CmpNoCase(pData->name)==0)
{
//pData->value.numberValue.number =2;
//zwString1024 adsa=pData-> expression;
memset(pData->expression, 0, sizeof(pData->expression));
strncpy(pData->expression, pParam->m_strVal, strlen(pParam->m_strVal));
}
}
}
err=ZwVariableListSet(nCount, arrData,1);
ZwEntityAutoRegen(ZW_REGEN_FOR_OUTDATED_OBJECTS,1);
ZwMemoryFree((void**)&arrData);
//m_tTplSld.Regenerate();
return true;
}
3.修改模型尺寸的值
bool ThkFastDesMdlCreateMng::EditDimVal(wxString strnewname)
{
std::vector<TzwDimension> arrAllDim;
GetAllDim(m_tTplSld,arrAllDim);
for (int i=0;i<m_vDriveDim.size();i++)
{
sDriveDim* pDim = m_vDriveDim[i];
if (pDim==nullptr)
{
continue;
}
for (int j=0;j<arrAllDim.size();j++)
{
TzwDimension tDim = arrAllDim[j];
wxString strDimaName = tDim.GetName();
if (strDimaName.CmpNoCase(pDim->m_strName) == 0)
{
wxString strowner = tDim.GetOwner().GetFullName();
wxString strownername = strnewname + _T("_") + pDim->m_strDDOwnerName;
if (strowner.CmpNoCase(strownername) == 0)
{
double dval;
pDim->m_strVal.ToDouble(&dval);
evxErrors err = tDim.SetValue(dval, true);
break;
}
}
}
}
ZwEntityAutoRegen(ZW_REGEN_FOR_ASSEMBLY_ALL_COMPONENT, 1);
return true;
}