【OBDCE C#】创建梁和柱

            STFLinearMemberList myMemberList = new STFLinearMemberList();
            STFLinearMember myMember;
            Bentley.Interop.MicroStationDGN.Point3d pPt=new Bentley.Interop.MicroStationDGN.Point3d();
            Bentley.Interop.MicroStationDGN.Point3d qPt = new Bentley.Interop.MicroStationDGN.Point3d();
            
            STFSectionList sectionList = new STFSectionList();
            STFSection section;
            section = sectionList.AsSTFSection;
            section.SetName("CAO5");

            pPt.X = 0;
            qPt.X = 1000;
            pPt.Y = qPt.Y= 0;
            pPt.Z = qPt.Z = 0;
            
            myMember = myMemberList.AsSTFLinearMember;
            myMember.SetPQPoints(ref pPt,ref qPt);
            myMember.SetSTFSection(section);
            myMember.SetPlacementPoint(5);
            myMember.SetCrossSectionReflection(true);
            myMember.CreateTFFormRecipeList();
            myMember.Save(false);

各位老师好,我正在摸索通过C#创建梁柱,查阅了以往的帖子写了如上代码,发现在CreateTFFormRecipeList处OBD会崩溃掉,请问应该如何修改,如有相关代码实例不胜感激,谢谢!

Parents

  • BIM.Application app = Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp;
    STFApplicationList stfAppList = new STFApplicationList();
    STFApplication stfApp = stfAppList.AsSTFApplication;
    STFLinearMemberList lstFrame = stfApp.GetAllLinearMembers(app.ActiveModelReference);
    STFSectionList lstSection = stfApp.GetSectionListFromTFSecMgr();
    //STFSectionList lstSection = stfApp.GetSection(); ;
    int scount = lstSection.GetCount();
    List<string> Ls = new List<string>();
    for (int i = 0; i < lstSection.GetCount(); ++i)
    {
    STFSectionList Sect = lstSection.GetNode(i);
    STFSection Section = Sect.AsSTFSection;
    Ls.Add(Section.GetName());

    }

    这样应该能导出界面名字了

Reply

  • BIM.Application app = Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp;
    STFApplicationList stfAppList = new STFApplicationList();
    STFApplication stfApp = stfAppList.AsSTFApplication;
    STFLinearMemberList lstFrame = stfApp.GetAllLinearMembers(app.ActiveModelReference);
    STFSectionList lstSection = stfApp.GetSectionListFromTFSecMgr();
    //STFSectionList lstSection = stfApp.GetSection(); ;
    int scount = lstSection.GetCount();
    List<string> Ls = new List<string>();
    for (int i = 0; i < lstSection.GetCount(); ++i)
    {
    STFSectionList Sect = lstSection.GetNode(i);
    STFSection Section = Sect.AsSTFSection;
    Ls.Add(Section.GetName());

    }

    这样应该能导出界面名字了

Children
No Data