ShapeElement shapeEle0 = new ShapeElement(dgnmodel, null, ptArr0); var temp = dLJ.XLverts4S.ToArray(); DPoint3d[] LinePoint = new DPoint3d[dLJ.XLverts4S.count]; for (int i = 0; i < dLJ.XLverts4S.count; i++) { LinePoint[i] = dLJ.XLverts4S[i]; } LineStringElement lineEle = new LineStringElement(dgnmodel, null, temp); CurveVector curVecPath = lineEle.GetCurveVector(); CurveVector curVecShape = shapeEle0.GetCurveVector(); CurveVector[] curVecShapePtr = new CurveVector[1]; curVecShapePtr[0] = curVecShape; Bentley.DgnPlatformNET.SolidKernelEntity[] solid = new SolidKernelEntity[1]; Bentley.DgnPlatformNET.Create.BodyFromSweep(out solid, curVecShapePtr, LinePoint, curVecPath, dgnmodel, null);
我调用该方法的第二种形式(需要用unsafe调用)好像也是导致Mstn崩溃。正在研究中...
一有结果在此反馈。
经过测试,这些新封装的BodyFromSweep、BodyFromLoft似乎都有问题。
还是先转到老的Interop对象模型使用吧。样例如下:
public static void SweepAlong(string unparsed) { BIM.Application app = BMI.Utilities.ComApp; BIM.Point3d[] aPoints = new BIM.Point3d[4]; aPoints[0] = app.Point3dFromXYZ(1.5, -1.5, 4); aPoints[1] = app.Point3dFromXYZ(-1.5, -1.5, 4); aPoints[2] = app.Point3dFromXYZ(-1.5, 1.5, 4); aPoints[3] = app.Point3dFromXYZ(1.5, 1.5, 4); BIM.ShapeElement profile = app.CreateShapeElement1(null, ref aPoints, BIM.MsdFillMode.NotFilled); BIM.Point3d[] bPoints = new BIM.Point3d[3]; bPoints[0] = app.Point3dFromXYZ(0, 0, 0); bPoints[1] = app.Point3dFromXYZ(0, 0, 1); bPoints[2] = app.Point3dFromXYZ(0, 0, 2); BIM.LineElement path = app.CreateLineElement1(null, ref bPoints); BIM.SmartSolidElement result = app.SmartSolid.SweepProfileAlongPath(profile, path); app.ActiveModelReference.AddElement(result); }
Answer Verified By: Yuteng Xue