CurveVector可以分解为CurvePrimitive,但不知多个CurvePrimitive合并为一个CurveVector,请老师们指点迷津哈。感谢啦
如下是C++代码构造CurveVector的方法,你可以模仿着来写对应的C#代码。
void createAComplexShape(WCharCP unparsed) { EditElementHandle eeh; DPoint3d basePt, pts[3]; basePt.x = 1.7*g_1mu; basePt.y = -0.3*g_1mu; basePt.z = -0.6*g_1mu; pts[0] = pts[1] = pts[2] = basePt; pts[1].x += g_1mu*0.3; pts[1].y += g_1mu*0.7; pts[0].x += g_1mu; pts[0].y += g_1mu; DEllipse3d arcPts = DEllipse3d::FromPointsOnArc(pts[2], pts[1], pts[0]); CurveVectorPtr pCurveVec = CurveVector::Create(CurveVector::BOUNDARY_TYPE_Outer); pCurveVec->Add(ICurvePrimitive::CreateArc(arcPts)); pts[1].x = pts[0].x; pts[1].y = pts[2].y; pCurveVec->Add(ICurvePrimitive::CreateLineString(pts, 3)); DraftingElementSchema::ToElement(eeh, *pCurveVec, nullptr, ACTIVEMODEL->Is3d(), *ACTIVEMODEL); eeh.AddToModel(); }
Answer Verified By: cao li
感谢符老师的解答,有一个疑问,为什么我进入到CurveVector类中没找到这个方法,我注意到CurveVector派生于C++的CurvePrimitive类,转不进去。
你说的“这个方法”是指CurveVector下的Add方法吗?从帮助文档中能找到呀。
另外,CurveVector和CurvePrimitive不是继承关系,CurveVector是CurvePrimitive的一个动态数组,用C++的STL(标准模板库)中的Vector容器收纳。
我的意思是,在C#中,我找到类,然后<转到定义>没找到这个方法。感谢符老师的解答哈
在CurveVector的定义中能看到,它派生于CurvePrimitiveCollection,这个Add方法应该是来自于Collection的。