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 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) { 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); }
private void WP_ProcessBar_Load() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_0105: Expected O, but got Unknown //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: 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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) this.progressBar1.Maximum = this.PB; Transaction val = this.I_trans = new Transaction(this.DOC); val.Start("JoinAll"); FailureHandlingOptions failureHandlingOptions = val.GetFailureHandlingOptions(); MyFailuresPreProcessor myFailuresPreProcessor = new MyFailuresPreProcessor(); failureHandlingOptions.SetFailuresPreprocessor(myFailuresPreProcessor); val.SetFailureHandlingOptions(failureHandlingOptions); List <ElementId> list = new List <ElementId>(); int num = 0; int num2 = 0; foreach (Element item in this.FL) { if (!val.HasStarted()) { break; } num2++; this.Text = "HotGear Project Join All Process : " + num2.ToString() + "/" + this.PB; this.progressBar1.Value = num2; try { GeometryElement val2 = item.get_Geometry(new Options()); Solid val3 = null; using (IEnumerator <GeometryObject> enumerator2 = val2.GetEnumerator()) { if (enumerator2.MoveNext()) { GeometryObject current2 = enumerator2.Current; val3 = (current2 as Solid); if (val3 != null) { list.Add(item.get_Id()); } } } ElementIntersectsSolidFilter val4 = new ElementIntersectsSolidFilter(val3); IList <Element> values = new FilteredElementCollector(this.DOC, (ICollection <ElementId>)list).WhereElementIsNotElementType().WherePasses(val4).ToElements(); Combinations <Element> combinations = new Combinations <Element>(values, 2, GenerateOption.WithoutRepetition); foreach (List <Element> item2 in combinations) { if (!JoinGeometryUtils.AreElementsJoined(this.DOC, item2[0], item2[1])) { try { JoinGeometryUtils.JoinGeometry(this.DOC, item2[0], item2[1]); num++; } catch { } } } } catch { } base.Show(); Application.DoEvents(); } if (val.HasStarted()) { this.I_trans.Commit(); base.Close(); } }