马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
我写了一段程序,但运行就出错,帮忙分析一下吧。初学SW的二次开发,大家别见笑
LPMODELDOC m_ModelDoc = NULL;
HRESULT hres = NOERROR;
hres = (TheApplication->GetSWApp())->get_IActiveDoc( [$m_ModelDoc )] // Retrieve IModelDoc pointer
if( m_ModelDoc == NULL )
return;
LPCONFIGURATION m_config = NULL;
hres = m_ModelDoc->IGetActiveConfiguration([$m_config)]
LPCOMPONENT2 m_component = NULL;
LPMATHTRANSFORM m_math = NULL;
double *p = new double[3];
p[0] = 0;
p[1] = 0;
p[2] = 0;
LPMATHUTILITY MathUtility;
(TheApplication->GetSWApp())->IGetMathUtility([$MathUtility)]
LPMATHPOINT* point;
MathUtility->ICreatePoint(p, point);
p[0] = 1;
p[1] = 0;
p[2] = 0;
LPMATHVECTOR* vector;
MathUtility->ICreateVector(p, vector);
double angle;
LPMATHTRANSFORM transform;
MathUtility->ICreateTransformRotateAxis ( *point, *vector, 10* 3.14159 /180, [$transform )]
VARIANT_BOOL retval;
if(m_config->IGetRootComponent2(&m_component) == S_OK )
{
m_component->SetTransformAndSolve2(transform, [$retval)]
}
m_ModelDoc->Release();
m_config->Release();
m_component->Release(); |