public void InitializeComponent(ExternalCommandData cmdData) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) this.cmddata = cmdData; this.HGUiApp = cmdData.get_Application(); this.HGDoc = this.HGUiApp.get_ActiveUIDocument().get_Document(); this.HGUiDoc = this.HGUiApp.get_ActiveUIDocument(); this.HGActiveView = this.HGDoc.get_ActiveView(); this.HGApp = cmdData.get_Application().get_Application(); }
public void InitializeComponent(ExternalCommandData cmdData) { this.cmddata = cmdData; this.HGUiApp = cmdData.get_Application(); this.HGDoc = this.HGUiApp.get_ActiveUIDocument().get_Document(); this.HGUiDoc = this.HGUiApp.get_ActiveUIDocument(); this.HGActiveView = this.HGDoc.get_ActiveView(); this.HGApp = cmdData.get_Application().get_Application(); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication val = commandData.get_Application(); Document doc = val.get_ActiveUIDocument().get_Document(); IList <FamilyInstance> projectZones = ZoneData.GetProjectZones(doc); IList <ElementId> list = (from z in (IEnumerable <FamilyInstance>) projectZones select z.get_Id()).ToList(); bool flag = projectZones.All((FamilyInstance z) => z.IsHidden(doc.get_ActiveView())); Transaction val2 = new Transaction(doc, flag ? "Unhide Zones" : "Hide Zones"); try { val2.Start(); if (flag) { doc.get_ActiveView().UnhideElements((ICollection <ElementId>)list); } else { doc.get_ActiveView().HideElements((ICollection <ElementId>)list); } val2.Commit(); } catch (OperationCanceledException) { return(1); } catch (Exception ex) { message = ex.Message; return(-1); } return(0); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication application = commandData.get_Application(); Document document = application.get_ActiveUIDocument().get_Document(); Selection selection = application.get_ActiveUIDocument().get_Selection(); ICollection <ElementId> elementIds = selection.GetElementIds(); List <Element> list = new List <Element>(); foreach (ElementId item in elementIds) { Element element = document.GetElement(item); list.Add(element); } if (list.Count > 0) { GlobolVar.G_JoinWay = "Miter"; WF_StartEnd wF_StartEnd = new WF_StartEnd(); wF_StartEnd.ShowDialog(); if (GlobolVar.G_JoinStatus == -1) { return(0); } Transaction val = new Transaction(document); val.Start("Miter"); FailureHandlingOptions failureHandlingOptions = val.GetFailureHandlingOptions(); MyFailuresPreProcessor myFailuresPreProcessor = new MyFailuresPreProcessor(); failureHandlingOptions.SetFailuresPreprocessor(myFailuresPreProcessor); val.SetFailureHandlingOptions(failureHandlingOptions); foreach (Element item2 in list) { try { if (GlobolVar.G_JoinStatus == 0) { (item2.get_Location() as LocationCurve).set_JoinType(1, 1); (item2.get_Location() as LocationCurve).set_JoinType(0, 1); } else if (GlobolVar.G_JoinStatus == 1) { (item2.get_Location() as LocationCurve).set_JoinType(0, 1); } else if (GlobolVar.G_JoinStatus == 2) { (item2.get_Location() as LocationCurve).set_JoinType(1, 1); } } catch (Exception) { } } val.Commit(); } else { TaskDialog.Show("Result", "None Element Selected"); } return(0); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication val = commandData.get_Application(); Document val2 = val.get_ActiveUIDocument().get_Document(); Selection val3 = val.get_ActiveUIDocument().get_Selection(); try { ICollection <ElementId> elementIds = val3.GetElementIds(); if (elementIds.Count == 0) { IList <Reference> refs = val3.PickObjects(1, "Select target elements for LOD change"); elementIds = LODapp.GetElementIds(val2, refs); } View viewFromElements = GetViewFromElements(val2, elementIds); IList <Element> list; if (viewFromElements == null) { IList <Element> elements2 = LODapp.GetElements(val2, elementIds); list = elements2; } else { list = GetFilteredElementsFromView(val2, viewFromElements); if (list == null) { return(1); } } if (setLODform == null) { setLODform = new SetLODform(); } setLODform.ShowDialog(); if (setLODform.DialogResult != DialogResult.OK) { return(1); } string selectedLODtype = setLODform.SelectedLODtype; int selectedLODvalue = setLODform.SelectedLODvalue; Definition parameterDefinition = LODapp.GetParameterDefinition(val2, selectedLODtype); Transaction val4 = new Transaction(val2, "Set LOD"); val4.Start(); LODapp.SetParameterOfElements((IEnumerable <Element>)list, parameterDefinition, selectedLODvalue); val4.Commit(); } catch (OperationCanceledException) { return(1); } catch (Exception ex) { message = ex.Message; return(-1); } return(0); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication application = commandData.get_Application(); Document document = application.get_ActiveUIDocument().get_Document(); UIDocument activeUIDocument = application.get_ActiveUIDocument(); Application application2 = commandData.get_Application().get_Application(); List <string> list = new List <string>(); foreach (Document document2 in application2.get_Documents()) { list.Add(document2.get_Title()); } GlobalVar.G_Doc_Selection = list; CategorySelection categorySelection = new CategorySelection(); categorySelection.InitializeComponent(commandData); categorySelection.ShowDialog(); List <Element> g_Ele = GlobalVar.G_Ele; List <string> g_Cat_Selection = GlobalVar.G_Cat_Selection; Document g_Sel_Doc = GlobalVar.G_Sel_Doc; if (g_Cat_Selection == null) { return(0); } List <ElementId> list2 = new List <ElementId>(); foreach (Element item in g_Ele) { foreach (string item2 in g_Cat_Selection) { if (item.get_Category().get_Name() == item2) { list2.Add(item.get_Category().get_Id()); } } } List <ElementId> cat_id = ((IEnumerable <ElementId>)list2).Distinct <ElementId>().ToList <ElementId>(); List <Element> list3 = Method.CategoryFilter(g_Sel_Doc, cat_id); WP_ProcessBar wP_ProcessBar = new WP_ProcessBar(g_Sel_Doc, list3, list3.Count); return(0); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication val = commandData.get_Application(); Document val2 = val.get_ActiveUIDocument().get_Document(); Selection val3 = val.get_ActiveUIDocument().get_Selection(); IList <ZoneData> projectZonesAsZoneData = ZoneData.GetProjectZonesAsZoneData(val2); IEnumerable <Element> enumerable = new FilteredElementCollector(val2).WhereElementIsNotElementType().OfClass(typeof(Level)).ToElements(); SortedList <double, Level> sortedList = new SortedList <double, Level>(enumerable.Count()); foreach (Level item in enumerable) { Level val4 = item; sortedList.Add(val4.get_Elevation(), val4); } IList <Element> list = new FilteredElementCollector(val2).WhereElementIsNotElementType().OfClass(typeof(Grid)).ToElements(); SortedList <double, Grid> sortedList2 = new SortedList <double, Grid>(); SortedList <double, Grid> sortedList3 = new SortedList <double, Grid>(); foreach (Grid item2 in list) { Grid val5 = item2; if (isNorthSouth(val5)) { sortedList2.Add(val5.get_Curve().GetEndPoint(0).get_X(), val5); } else if (isEastWest(val5)) { sortedList3.Add(val5.get_Curve().GetEndPoint(0).get_Y(), val5); } } editZonesForm = new EditZonesForm(projectZonesAsZoneData, sortedList, sortedList2, sortedList3, val2.GetUnits()); editZonesForm.ShowDialog(); if (editZonesForm.DialogResult == DialogResult.OK) { IList <ZoneData> editedZones = editZonesForm.EditedZones; Transaction val6 = new Transaction(val2, "Update Project Zones"); try { val6.Start(); ZoneData.UpdateRevitProjectZones(val2, editedZones); val6.Commit(); } catch (OperationCanceledException) { return(1); } catch (Exception ex) { message = ex.Message; return(-1); } return(0); } return(1); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication application = commandData.get_Application(); Document document = application.get_ActiveUIDocument().get_Document(); Selection selection = application.get_ActiveUIDocument().get_Selection(); ICollection <ElementId> elementIds = selection.GetElementIds(); if (elementIds.Count != 0) { List <Element> list = Method.GeometryFilter(document, elementIds); int num = 0; if (list.Count > 1) { Combinations <Element> combinations = new Combinations <Element>(list, 2, GenerateOption.WithoutRepetition); Transaction val = new Transaction(document); val.Start("Merger Element"); FailureHandlingOptions failureHandlingOptions = val.GetFailureHandlingOptions(); MyFailuresPreProcessor myFailuresPreProcessor = new MyFailuresPreProcessor(); failureHandlingOptions.SetFailuresPreprocessor(myFailuresPreProcessor); val.SetFailureHandlingOptions(failureHandlingOptions); foreach (List <Element> item in combinations) { if (!JoinGeometryUtils.AreElementsJoined(document, item[0], item[1])) { try { JoinGeometryUtils.JoinGeometry(document, item[0], item[1]); num++; } catch { } } } MessageBox.Show(num.ToString() + " Pairs Elements Successfully Join.", "ElementMerger"); val.Commit(); } else if (list.Count == 1) { TaskDialog.Show("ElementMerger", "Only One Element Selected"); } } else { TaskDialog.Show("ElementMerger", "None Element Selected"); } return(0); }
public Result Execute( ExternalCommandData commandData, ref string message, ElementSet elements) { Document document = commandData.get_Application().get_ActiveUIDocument().get_Document(); FileOpenDialog fileOpenDialog = new FileOpenDialog("SAT file (*.sat)|*.sat"); ((FileDialog)fileOpenDialog).set_Title("Select SAT file to import"); ((FileDialog)fileOpenDialog).Show(); ModelPath selectedModelPath = ((FileDialog)fileOpenDialog).GetSelectedModelPath(); ((FileDialog)fileOpenDialog).Dispose(); string userVisiblePath = ModelPathUtils.ConvertModelPathToUserVisiblePath(selectedModelPath); SATImportOptions satImportOptions = new SATImportOptions(); View element = new FilteredElementCollector(document).OfClass(typeof(View)).ToElements()[0] as View; try { using (Transaction transaction = new Transaction(document, "Import SAT")) { transaction.Start(); ElementId elementId = document.Import(userVisiblePath, satImportOptions, element); using (IEnumerator <GeometryObject> enumerator1 = document.GetElement(elementId).get_Geometry(new Options()).GetEnumerator()) { while (((IEnumerator)enumerator1).MoveNext()) { using (IEnumerator <GeometryObject> enumerator2 = (enumerator1.Current as GeometryInstance).get_SymbolGeometry().GetEnumerator()) { while (((IEnumerator)enumerator2).MoveNext()) { Solid current = enumerator2.Current as Solid; FreeFormElement.Create(document, current); } } } } document.Delete(elementId); transaction.Commit(); } return((Result)0); } catch { TaskDialog.Show("Error Importing", "Something went wrong"); return((Result) - 1); } }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication val = commandData.get_Application(); Document val2 = val.get_ActiveUIDocument().get_Document(); IList <View3D> views = new FilteredElementCollector(val2).WhereElementIsNotElementType().OfClass(typeof(View3D)).ToElements() .Cast <View3D>() .ToList(); ViewsForZonesForm viewsForZonesForm = new ViewsForZonesForm(views, val2.get_ActiveView() as View3D); viewsForZonesForm.ShowDialog(); if (viewsForZonesForm.DialogResult != DialogResult.OK) { return(1); } View3D selectedView = viewsForZonesForm.SelectedView; XYZ val3 = new XYZ(0.0 - VIEW_CROP_OFFSETS[5], 0.0 - VIEW_CROP_OFFSETS[3], 0.0 - VIEW_CROP_OFFSETS[1]); XYZ val4 = new XYZ(VIEW_CROP_OFFSETS[4], VIEW_CROP_OFFSETS[2], VIEW_CROP_OFFSETS[0]); IList <FamilyInstance> projectZones = ZoneData.GetProjectZones(val2); Transaction val5 = new Transaction(val2, "Create Views for Project Zones"); try { val5.Start(); foreach (FamilyInstance item in projectZones) { ElementId val6 = selectedView.Duplicate(0); View3D val7 = val2.GetElement(val6) as View3D; BoundingBoxXYZ val8 = item.get_BoundingBox(null); BoundingBoxXYZ val9 = new BoundingBoxXYZ(); val9.set_Min(val8.get_Min() + val3); val9.set_Max(val8.get_Max() + val4); val7.set_Name("3D " + item.LookupParameter("Name").AsString()); val7.SetSectionBox(val9); } val5.Commit(); } catch (OperationCanceledException) { return(1); } catch (Exception ex) { message = ex.Message; return(-1); } return(0); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIDocument activeUiDocument = commandData.get_Application().get_ActiveUIDocument(); Document document = activeUiDocument.get_Document(); using (TransactionGroup transactionGroup = new TransactionGroup(document)) { using (Transaction tx = new Transaction(document)) { try { transactionGroup.Start("Arrange Tags"); this.ArrangeTag(activeUiDocument, tx); transactionGroup.Assimilate(); return((Result)0); } catch (OperationCanceledException ex) { message = ((Exception)ex).Message; if (tx.HasStarted()) { tx.RollBack(); } return((Result)1); } catch (ErrorMessageException ex) { message = ex.Message; if (tx.HasStarted()) { tx.RollBack(); } return((Result) - 1); } catch (Exception ex) { message = ex.Message; if (tx.HasStarted()) { tx.RollBack(); } return((Result) - 1); } } } }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication application = commandData.get_Application(); UIDocument activeUIDocument = application.get_ActiveUIDocument(); application.get_Application(); Document document = activeUIDocument.get_Document(); View3D val = this.Get3dView(document); if ((int)val == 0) { message = "Sorry, no suitable 3D view found"; return(-1); } activeUIDocument.set_ActiveView(val); Transaction val2 = new Transaction(document); val2.Start("Change to 3D view"); val.get_Parameter(-1011002).Set(3); val.get_Parameter(-1005165).Set(2); List <Category> list = new List <Category>(); list.Add(Category.GetCategory(document, -2000038)); list.Add(Category.GetCategory(document, -2000100)); list.Add(Category.GetCategory(document, -2000171)); list.Add(Category.GetCategory(document, -2000170)); list.Add(Category.GetCategory(document, -2000023)); list.Add(Category.GetCategory(document, -2000032)); list.Add(Category.GetCategory(document, -2001180)); list.Add(Category.GetCategory(document, -2000180)); list.Add(Category.GetCategory(document, -2001220)); list.Add(Category.GetCategory(document, -2000035)); list.Add(Category.GetCategory(document, -2001260)); list.Add(Category.GetCategory(document, -2000120)); list.Add(Category.GetCategory(document, -2001340)); list.Add(Category.GetCategory(document, -2000011)); list.Add(Category.GetCategory(document, -2000014)); if (new SelectCategories(document, val, list).ShowDialog() == DialogResult.Cancel) { return(1); } val2.Commit(); new ReadyToExport().ShowDialog(); return(0); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between O and Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (null == commandData) { throw new ArgumentNullException("commandData"); } CEntry cEntry = new CEntry(); cEntry.Start(commandData.get_Application().get_ActiveUIDocument().get_Document()); return(0); }
public virtual Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04cd: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Unknown result type (might be due to invalid IL or missing references) GlobalVar.G_commandData = commandData; UIApplication application = commandData.get_Application(); Document document = application.get_ActiveUIDocument().get_Document(); UIDocument activeUIDocument = application.get_ActiveUIDocument(); Application application2 = commandData.get_Application().get_Application(); View activeView = document.get_ActiveView(); GlobalVar.TypeORInstance = "Family Instance"; Selection selection = application.get_ActiveUIDocument().get_Selection(); ICollection <ElementId> elementIds = selection.GetElementIds(); List <Element> list = new List <Element>(); foreach (ElementId item in elementIds) { Element element = document.GetElement(item); list.Add(element); } if (list.Count > 0) { DataSet dataSet = new DataSet(); DataSet dataSet2 = new DataSet(); List <ElementId> list2 = new List <ElementId>(); foreach (Element item2 in list) { try { list2.Add(item2.get_Category().get_Id()); } catch { MessageBox.Show("None Category Instance Is Not Support.", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } List <ElementId> list3 = ((IEnumerable <ElementId>)list2).Distinct <ElementId>().ToList <ElementId>(); if (list3.Count == 0) { return(0); } foreach (ElementId item3 in list3) { FilteredElementCollector val = new FilteredElementCollector(document, elementIds).OfCategoryId(item3); IList <Element> eleList = val.ToElements(); DataTable table = Method.ElementParameter2Table(commandData, eleList); DataTable table2 = Method.ParameterIsRead(commandData, eleList, document); dataSet.Tables.Add(table); dataSet2.Tables.Add(table2); } ParameterEventHandler parameterEventHandler = new ParameterEventHandler(); ElementOverrideEventHandler elementOverrideEventHandler = new ElementOverrideEventHandler(); ResetElementOverrideEventHandler resetElementOverrideEventHandler = new ResetElementOverrideEventHandler(); ExternalEvent g_exEvent = ExternalEvent.Create(parameterEventHandler); ExternalEvent g_exEvent2 = ExternalEvent.Create(elementOverrideEventHandler); ExternalEvent g_exEvent3 = ExternalEvent.Create(resetElementOverrideEventHandler); GlobalVar.G_handler = parameterEventHandler; GlobalVar.G_exEvent = g_exEvent; GlobalVar.G_handler1 = elementOverrideEventHandler; GlobalVar.G_exEvent1 = g_exEvent2; GlobalVar.G_handler3 = resetElementOverrideEventHandler; GlobalVar.G_exEvent3 = g_exEvent3; GlobalVar.MyDataSet = dataSet; GlobalVar.Is_Read_Only = dataSet2; HotGear_Parameter_Explorer hotGear_Parameter_Explorer = new HotGear_Parameter_Explorer(); hotGear_Parameter_Explorer.InitializeComponent(commandData, document); hotGear_Parameter_Explorer.Show(); } else { List <string> list4 = new List <string>(); foreach (Document document2 in application2.get_Documents()) { list4.Add(document2.get_Title()); } GlobalVar.G_Doc_Selection = list4; CategorySelection categorySelection = new CategorySelection(); categorySelection.InitializeComponent(commandData); categorySelection.ShowDialog(); List <Element> g_Ele = GlobalVar.G_Ele; List <string> g_Cat_Selection = GlobalVar.G_Cat_Selection; Document g_Sel_Doc = GlobalVar.G_Sel_Doc; ICollection <ElementId> g_Eleid = GlobalVar.G_Eleid; if (g_Cat_Selection == null) { return(0); } DataSet dataSet3 = new DataSet(); DataSet dataSet4 = new DataSet(); List <ElementId> list5 = new List <ElementId>(); foreach (Element item4 in g_Ele) { foreach (string item5 in g_Cat_Selection) { if (item4.get_Category().get_Name() == item5) { list5.Add(item4.get_Category().get_Id()); } } } List <ElementId> list6 = ((IEnumerable <ElementId>)list5).Distinct <ElementId>().ToList <ElementId>(); if (list6.Count == 0) { return(0); } foreach (ElementId item6 in list6) { FilteredElementCollector val3 = new FilteredElementCollector(g_Sel_Doc, g_Eleid).OfCategoryId(item6); IList <Element> eleList2 = val3.ToElements(); DataTable table3 = Method.ElementParameter2Table(commandData, eleList2); DataTable table4 = Method.ParameterIsRead(commandData, eleList2, g_Sel_Doc); dataSet3.Tables.Add(table3); dataSet4.Tables.Add(table4); } ParameterEventHandler parameterEventHandler2 = new ParameterEventHandler(); ElementOverrideEventHandler elementOverrideEventHandler2 = new ElementOverrideEventHandler(); ResetElementOverrideEventHandler resetElementOverrideEventHandler2 = new ResetElementOverrideEventHandler(); ExternalEvent g_exEvent4 = ExternalEvent.Create(parameterEventHandler2); ExternalEvent g_exEvent5 = ExternalEvent.Create(elementOverrideEventHandler2); ExternalEvent g_exEvent6 = ExternalEvent.Create(resetElementOverrideEventHandler2); GlobalVar.G_handler = parameterEventHandler2; GlobalVar.G_exEvent = g_exEvent4; GlobalVar.G_handler1 = elementOverrideEventHandler2; GlobalVar.G_exEvent1 = g_exEvent5; GlobalVar.G_handler3 = resetElementOverrideEventHandler2; GlobalVar.G_exEvent3 = g_exEvent6; GlobalVar.MyDataSet = dataSet3; GlobalVar.Is_Read_Only = dataSet4; HotGear_Parameter_Explorer hotGear_Parameter_Explorer2 = new HotGear_Parameter_Explorer(); hotGear_Parameter_Explorer2.InitializeComponent(commandData, g_Sel_Doc); hotGear_Parameter_Explorer2.Show(); } return(0); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_0509: Unknown result type (might be due to invalid IL or missing references) GlobalVar.G_commandData = commandData; UIApplication application = commandData.get_Application(); Document document = application.get_ActiveUIDocument().get_Document(); UIDocument activeUIDocument = application.get_ActiveUIDocument(); Application application2 = commandData.get_Application().get_Application(); View activeView = document.get_ActiveView(); GlobalVar.TypeORInstance = "Family Type"; Selection selection = application.get_ActiveUIDocument().get_Selection(); ICollection <ElementId> elementIds = selection.GetElementIds(); ICollection <ElementId> collection = new List <ElementId>(); List <Element> list = new List <Element>(); foreach (ElementId item in elementIds) { try { Element element = document.GetElement(item); ElementId typeId = element.GetTypeId(); Element element2 = document.GetElement(typeId); collection.Add(typeId); list.Add(element2); } catch { } } if (list.Count > 0) { DataSet dataSet = new DataSet(); DataSet dataSet2 = new DataSet(); List <ElementId> list2 = new List <ElementId>(); foreach (Element item2 in list) { try { list2.Add(item2.get_Category().get_Id()); } catch { } } List <ElementId> list3 = ((IEnumerable <ElementId>)list2).Distinct <ElementId>().ToList <ElementId>(); foreach (ElementId item3 in list3) { FilteredElementCollector val = new FilteredElementCollector(document, collection).OfCategoryId(item3); IList <Element> eleList = val.ToElements(); DataTable table = Method.ElementParameter2Table(commandData, eleList); DataTable table2 = Method.ParameterIsRead(commandData, eleList, document); dataSet.Tables.Add(table); dataSet2.Tables.Add(table2); } ParameterEventHandler parameterEventHandler = new ParameterEventHandler(); ElementOverrideEventHandler elementOverrideEventHandler = new ElementOverrideEventHandler(); ResetElementOverrideEventHandler resetElementOverrideEventHandler = new ResetElementOverrideEventHandler(); ExternalEvent g_exEvent = ExternalEvent.Create(parameterEventHandler); ExternalEvent g_exEvent2 = ExternalEvent.Create(elementOverrideEventHandler); ExternalEvent g_exEvent3 = ExternalEvent.Create(resetElementOverrideEventHandler); GlobalVar.G_handler = parameterEventHandler; GlobalVar.G_exEvent = g_exEvent; GlobalVar.G_handler1 = elementOverrideEventHandler; GlobalVar.G_exEvent1 = g_exEvent2; GlobalVar.G_handler3 = resetElementOverrideEventHandler; GlobalVar.G_exEvent3 = g_exEvent3; GlobalVar.MyDataSet = dataSet; GlobalVar.Is_Read_Only = dataSet2; HotGear_Parameter_Explorer hotGear_Parameter_Explorer = new HotGear_Parameter_Explorer(); hotGear_Parameter_Explorer.InitializeComponent(commandData, document); hotGear_Parameter_Explorer.Show(); } else { List <string> list4 = new List <string>(); foreach (Document document2 in application2.get_Documents()) { list4.Add(document2.get_Title()); } GlobalVar.G_Doc_Selection = list4; CategorySelection categorySelection = new CategorySelection(); categorySelection.InitializeComponent(commandData); categorySelection.ShowDialog(); List <Element> g_Ele = GlobalVar.G_Ele; List <string> g_Cat_Selection = GlobalVar.G_Cat_Selection; Document g_Sel_Doc = GlobalVar.G_Sel_Doc; ICollection <ElementId> g_Eleid = GlobalVar.G_Eleid; if (g_Cat_Selection == null) { return(0); } List <ElementId> list5 = new List <ElementId>(); foreach (Element item4 in g_Ele) { foreach (string item5 in g_Cat_Selection) { if (item4.get_Category().get_Name() == item5) { list5.Add(item4.get_Category().get_Id()); } } } DataSet dataSet3 = new DataSet(); DataSet dataSet4 = new DataSet(); List <ElementId> list6 = ((IEnumerable <ElementId>)list5).Distinct <ElementId>().ToList <ElementId>(); foreach (ElementId item6 in list6) { FilteredElementCollector val3 = new FilteredElementCollector(g_Sel_Doc, g_Eleid).OfCategoryId(item6); IList <Element> list7 = new List <Element>(); foreach (Element item7 in val3) { list7.Add(item7); } DataTable table3 = Method.ElementParameter2Table(commandData, list7); DataTable table4 = Method.ParameterIsRead(commandData, list7, g_Sel_Doc); dataSet3.Tables.Add(table3); dataSet4.Tables.Add(table4); } ParameterEventHandler parameterEventHandler2 = new ParameterEventHandler(); ElementOverrideEventHandler elementOverrideEventHandler2 = new ElementOverrideEventHandler(); ResetElementOverrideEventHandler resetElementOverrideEventHandler2 = new ResetElementOverrideEventHandler(); ExternalEvent g_exEvent4 = ExternalEvent.Create(parameterEventHandler2); ExternalEvent g_exEvent5 = ExternalEvent.Create(elementOverrideEventHandler2); ExternalEvent g_exEvent6 = ExternalEvent.Create(resetElementOverrideEventHandler2); GlobalVar.G_handler = parameterEventHandler2; GlobalVar.G_exEvent = g_exEvent4; GlobalVar.G_handler1 = elementOverrideEventHandler2; GlobalVar.G_exEvent1 = g_exEvent5; GlobalVar.G_handler3 = resetElementOverrideEventHandler2; GlobalVar.G_exEvent3 = g_exEvent6; GlobalVar.MyDataSet = dataSet3; GlobalVar.Is_Read_Only = dataSet4; HotGear_Parameter_Explorer hotGear_Parameter_Explorer2 = new HotGear_Parameter_Explorer(); hotGear_Parameter_Explorer2.InitializeComponent(commandData, g_Sel_Doc); hotGear_Parameter_Explorer2.Show(); } return(0); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) UIApplication application = commandData.get_Application(); Document document = application.get_ActiveUIDocument().get_Document(); UIDocument activeUIDocument = application.get_ActiveUIDocument(); Application application2 = commandData.get_Application().get_Application(); List <string> list = new List <string>(); foreach (Document document2 in application2.get_Documents()) { list.Add(document2.get_Title()); } GlobalVar.G_Doc_Selection = list; CategorySelection categorySelection = new CategorySelection(); categorySelection.InitializeComponent(commandData); categorySelection.ShowDialog(); List <Family> g_Ele = GlobalVar.G_Ele; List <string> g_Cat_Selection = GlobalVar.G_Cat_Selection; string g_Path = GlobalVar.G_Path; Document g_Sel_Doc = GlobalVar.G_Sel_Doc; if (g_Cat_Selection == null) { return(0); } List <ElementId> list2 = new List <ElementId>(); foreach (Family item in g_Ele) { foreach (string item2 in g_Cat_Selection) { if (item.get_FamilyCategory().get_Name() == item2) { list2.Add(item.get_FamilyCategory().get_Id()); } } } List <ElementId> cat_id = ((IEnumerable <ElementId>)list2).Distinct <ElementId>().ToList <ElementId>(); List <Family> list3 = Method.CategoryFilter(g_Sel_Doc, cat_id); int count = list3.Count; WP_ProcessBar wP_ProcessBar = new WP_ProcessBar(g_Sel_Doc, g_Path, list3, count); return(0); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication val = commandData.get_Application(); Document val2 = val.get_ActiveUIDocument().get_Document(); Selection val3 = val.get_ActiveUIDocument().get_Selection(); try { if (lodFilterForm == null) { lodFilterForm = new LODfilterForm(); } lodFilterForm.ShowDialog(); if (lodFilterForm.DialogResult != DialogResult.OK) { return(1); } bool[] fillColorEnabled = lodFilterForm.GetFillColorEnabled(); bool[] lineColorEnabled = lodFilterForm.GetLineColorEnabled(); bool[] visibilitesEnabled = lodFilterForm.GetVisibilitesEnabled(); int[] transparencies = lodFilterForm.GetTransparencies(); CreateFiltersIfMissing(val2); IList <ElementId> list = ApplyLODfiltersToView(val2, val2.get_ActiveView()); Transaction val4 = new Transaction(val2, "Apply LOD filters"); val4.Start(); View val5 = val2.get_ActiveView(); for (int i = 0; i < filterNames.Length; i++) { OverrideGraphicSettings val6 = new OverrideGraphicSettings(); if (lineColorEnabled[i]) { val6.SetCutLineColor(lodFilterColors[i]); val6.SetProjectionLineColor(lodFilterColors[i]); } ElementId solidFillId = GetSolidFillId(val2); if (fillColorEnabled[i]) { val6.SetCutForegroundPatternColor(lodFilterColors[i]); val6.SetCutBackgroundPatternColor(lodFilterColors[i]); val6.SetSurfaceForegroundPatternColor(lodFilterColors[i]); val6.SetSurfaceBackgroundPatternColor(lodFilterColors[i]); val6.SetSurfaceForegroundPatternId(solidFillId); val6.SetSurfaceBackgroundPatternId(solidFillId); } val6.SetSurfaceTransparency(transparencies[i]); val5.SetFilterOverrides(list[i], val6); val5.SetFilterVisibility(list[i], visibilitesEnabled[i]); } val4.Commit(); } catch (OperationCanceledException) { return(1); } catch (Exception ex) { message = ex.Message; return(-1); } return(0); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { Application val = commandData.get_Application().get_Application(); Document val2 = commandData.get_Application().get_ActiveUIDocument().get_Document(); Definition val3 = LODapp.GetParameterDefinition(val2, "Current_LOD"); Definition val4 = LODapp.GetParameterDefinition(val2, "Target_LOD"); Definition val5 = LODapp.GetParameterDefinition(val2, "MEA"); Definition val6 = LODapp.GetParameterDefinition(val2, "Zone"); Transaction val7 = new Transaction(val2, "Create LOD Parameter"); try { val7.Start(); string tempPath = Path.GetTempPath(); tempPath += "LODmanager\\"; Directory.CreateDirectory(tempPath); string text = tempPath + "RevitParameters.txt"; FileStream fileStream = File.Create(text); fileStream.Close(); val.set_SharedParametersFilename(text); DefinitionFile val8 = val.OpenSharedParameterFile(); DefinitionGroup val9 = val8.get_Groups().Create("BIM"); if (val3 == null) { ExternalDefinitionCreationOptions val10 = new ExternalDefinitionCreationOptions("Current_LOD", 2); val10.set_Description("The Current Level of Development of the Object. \nOptions: 100, 200, 300, 350, 400. \nSee LOD Specification for details."); val3 = val9.get_Definitions().Create(val10); } if (val4 == null) { ExternalDefinitionCreationOptions val11 = new ExternalDefinitionCreationOptions("Target_LOD", 2); val11.set_Description("The Target Level of Development of the Object. \nOptions: 100, 200, 300, 350, 400. \nSee LOD Specification for details."); val4 = val9.get_Definitions().Create(val11); } if (val5 == null) { ExternalDefinitionCreationOptions val12 = new ExternalDefinitionCreationOptions("MEA", 1); val12.set_Description("The Model Element Author for the Object."); val5 = val9.get_Definitions().Create(val12); } if (val6 == null) { ExternalDefinitionCreationOptions val13 = new ExternalDefinitionCreationOptions("Zone", 1); val13.set_Description("The Zone in which this Object resides."); val6 = val9.get_Definitions().Create(val13); } CategorySet val14 = val.get_Create().NewCategorySet(); BuiltInCategory[] lodCatArray = LODapp.lodCatArray; foreach (BuiltInCategory val15 in lodCatArray) { Category val16 = val2.get_Settings().get_Categories().get_Item(val15); val14.Insert(val16); } InstanceBinding val17 = val.get_Create().NewInstanceBinding(val14); val2.get_ParameterBindings().Insert(val3, val17, -5000175); val2.get_ParameterBindings().Insert(val4, val17, -5000175); val2.get_ParameterBindings().Insert(val5, val17, -5000175); val2.get_ParameterBindings().Insert(val6, val17, -5000175); val7.Commit(); } catch (Exception ex) { val7.RollBack(); message = ex.ToString(); return(-1); } val7 = new Transaction(val2, "Set Default LOD Values"); try { val7.Start(); BuiltInCategory[] lodCatArray2 = LODapp.lodCatArray; foreach (BuiltInCategory val18 in lodCatArray2) { FilteredElementCollector val19 = new FilteredElementCollector(val2); val19.OfCategory(val18); IEnumerable <Element> elems = val19.ToElements(); LODapp.SetParameterOfElementsIfNotSet(elems, val3, 200); } val7.Commit(); } catch (Exception ex2) { val7.RollBack(); message = ex2.ToString(); return(-1); } return(0); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication application = commandData.get_Application(); Document document = application.get_ActiveUIDocument().get_Document(); Selection selection = application.get_ActiveUIDocument().get_Selection(); ICollection <ElementId> elementIds = selection.GetElementIds(); List <Element> list = new List <Element>(); foreach (ElementId item in elementIds) { Element element = document.GetElement(item); list.Add(element); } if (list.Count > 0) { GlobolVar.G_JoinWay = "Allow"; WF_StartEnd wF_StartEnd = new WF_StartEnd(); wF_StartEnd.ShowDialog(); if (GlobolVar.G_JoinStatus == -1) { return(0); } Transaction val = new Transaction(document); val.Start("AllowJoin"); foreach (Element item2 in list) { if (item2.get_Category().get_Id().get_IntegerValue() == -2000011) { try { FailureHandlingOptions failureHandlingOptions = val.GetFailureHandlingOptions(); MyFailuresPreProcessor myFailuresPreProcessor = new MyFailuresPreProcessor(); failureHandlingOptions.SetFailuresPreprocessor(myFailuresPreProcessor); val.SetFailureHandlingOptions(failureHandlingOptions); if (GlobolVar.G_JoinStatus == 0) { WallUtils.AllowWallJoinAtEnd(item2 as Wall, 0); WallUtils.AllowWallJoinAtEnd(item2 as Wall, 1); } else if (GlobolVar.G_JoinStatus == 1) { WallUtils.AllowWallJoinAtEnd(item2 as Wall, 0); } else if (GlobolVar.G_JoinStatus == 2) { WallUtils.AllowWallJoinAtEnd(item2 as Wall, 1); } } catch { } } } val.Commit(); } else { TaskDialog.Show("Result", "None Element Selected"); } return(0); }