,我的代码片段
// 获得用户选择的路线 Bentley.CifNET.GeometryModel.RoadwayDesigner.Corridor rdCorridor = OrdObjectSpaceUtil.Active.GetObject<Bentley.CifNET.GeometryModel.RoadwayDesigner.Corridor>(element); Console.WriteLine(rdCorridor.Name); if (!(element.ElementType == (MSElementType) 106)) { MsNotificationUtil.OutputInfo("所选元素不是廊道对象"); return; } // ConsensusConnection m_con = new ConsensusConnection(Bentley.MstnPlatformNET.Session.Instance.GetActiveDgnModelRef()); Corridor corridor = (element.ParentElement == null) ? Corridor.CreateFromElement(m_con, element) : Corridor.CreateFromElement(m_con, element.ParentElement); if (corridor == null) { MsNotificationUtil.OutputInfo("所选元素不是廊道对象"); return; } try { Alignment corridorAlignment = corridor.CorridorAlignment; // 此处抛出AccessViolationException崩溃 } catch (AccessViolationException ex) { Trace.WriteLine(ex); }
提前谢过。
搜索
复制