링크 참조 : http://theactoflearning.blogspot.kr/2014/06/microstation-add-in-creating-add-in.html
public static void ItemAttachCommand(string unparsed) { ElementScanCriteria sc = new ElementScanCriteriaClass(); { sc.ExcludeAllTypes(); sc.IncludeType(MsdElementType.CellHeader); sc.IncludeType(MsdElementType.Surface); } int i = Bentley.MicroStation.InteropServices.Utilities.ComApp.ActiveModelReference.MdlModelRefP(); XmlInstanceSchemaManager oSchemaManager = new XmlInstanceSchemaManager(new IntPtr(i)); IList<string> oSchemas = oSchemaManager.ReadSchemas(); XmlInstanceApi oXmlInstanceApi = XmlInstanceApi.CreateApi(oSchemaManager); ElementEnumerator ee = Bentley.MicroStation.InteropServices.Utilities.ComApp.ActiveModelReference.Scan(sc); while (ee.MoveNext()) { CellElement oCell = ee.Current.AsCellElement(); //if (("Component_0001388c-0000-0000-7409-f9ad8c553b82" != oCell.Name)) continue; int iEle = oCell.MdlElementRef(); Element oEle = Bentley.MicroStation.InteropServices.Utilities.ComApp.ActiveModelReference.GetElementByID64(oCell.ID64); IList<string> oAttrs = oXmlInstanceApi.ReadInstances(new IntPtr(iEle)); foreach (string attr in oAttrs) { } switch(ee.Current.Type) { case MsdElementType.CellHeader: ScanCell(ee.Current.AsCellElement()); break; } //Bentley.ECXAttributes.ECXAttributes.Traverse(new Bentley.ECXAttributes.ECXAttributes.TraverseDelegate(f1), (oCell as Bentley.Internal.MicroStation.Elements.Element), null); //string sName = oCell.Name; } }
댓글
댓글 쓰기