ZW 小结1:模型信息获取(变量....)

一、获取模型的参数

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;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

行为艺术家Zzz

新人 求鼓励

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值