【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 Reply
  • 开始我试过sectionList.InitFromTFSecMgr(),打印出sectionList数量1527个,但section的名称打印出来却是空,还是不知如何成功建模。

    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();
                sectionList.InitFromTFSecMgr();
    
                int iCount=sectionList.GetCount();
                MessageBox.Show(iCount.ToString());
                
                STFSection section;
                for (int i = 0; i < iCount; i++)
                {
                    section = sectionList.GetSectionByIndex(i);
                    MessageBox.Show(section.GetName());
                }

Children