[MSCE C#]创建MultiLine但没有显示出来

public static Element CreateMultiLineElement(DgnModel dgnModel)
        {
            double uor = dgnModel.GetModelInfo().UorPerMaster;

            DPoint3d[] points = new DPoint3d[5];
            points[0] = new DPoint3d(-100, 0) * uor;
            points[1] = new DPoint3d(0, -100) * uor;
            points[2] = new DPoint3d(100, 0) * uor;
            points[3] = new DPoint3d(200, 0) * uor;
            points[4] = new DPoint3d(300, -100) * uor;

            MultilineStyle lineStyle = new MultilineStyle("name", dgnModel.GetDgnFile());
            MultilineElement element = MultilineElement.CreateMultilineElement(dgnModel, null, lineStyle, 1.0, DVector3d.UnitX, points);
            //CurveElement element = new CurveElement(dgnModel, null, points);
            return element;
        }
创建了一个MultilineElement,但是没有成功,请问代码有什么问题?

Parents
  • 您创建了一个空的MultilineStyle。需要在12和13行间插入如下代码才可以:

    MultilineProfile profile1 = new MultilineProfile();
                profile1.Distance = 0;
                profile1.UseLinestyle = true;
                profile1.Linestyle = 2;
                lineStyle.InsertProfile(profile1, 0);
                MultilineProfile profile2 = new MultilineProfile();
                profile2.Distance = -150;
                lineStyle.InsertProfile(profile2, 1);
                MultilineProfile profile3 = new MultilineProfile();
                profile3.Distance = 150;
                lineStyle.InsertProfile(profile3, 2);

    生成结果如下:



    Answer Verified By: lingwei liu 

Reply
  • 您创建了一个空的MultilineStyle。需要在12和13行间插入如下代码才可以:

    MultilineProfile profile1 = new MultilineProfile();
                profile1.Distance = 0;
                profile1.UseLinestyle = true;
                profile1.Linestyle = 2;
                lineStyle.InsertProfile(profile1, 0);
                MultilineProfile profile2 = new MultilineProfile();
                profile2.Distance = -150;
                lineStyle.InsertProfile(profile2, 1);
                MultilineProfile profile3 = new MultilineProfile();
                profile3.Distance = 150;
                lineStyle.InsertProfile(profile3, 2);

    生成结果如下:



    Answer Verified By: lingwei liu 

Children