public Result Execute( ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication uiapp = commandData.Application; UIDocument uidoc = uiapp.ActiveUIDocument; Application app = uiapp.Application; doc = uidoc.Document; Selection sel = uidoc.Selection; Reference ef = sel.PickObject(ObjectType.Element, new AssemblySelectionfilter(), "Select Assembly"); Element ele = doc.GetElement(ef); AssemblyInstance instance = ele as AssemblyInstance; elesource = ElementtransformToCopy.Elementcopy(doc, instance); ElementtransformToCopy tr = new ElementtransformToCopy(); dic_element = GetElements(doc, instance); listtarget = Selectionceg.SelectionbyControl_Mark(doc, elesource); using (FrmCopyReforcement form = new FrmCopyReforcement(this, doc)) { form.ShowDialog(); if (form.listcopy.Count != 0) { tr.CopyElements(doc, elesource, listtarget, form.listcopy); } } return(Result.Succeeded); }
public Result Execute( ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication uiapp = commandData.Application; UIDocument uidoc = uiapp.ActiveUIDocument; Application app = uiapp.Application; doc = uidoc.Document; Selection sel = uidoc.Selection; Reference ef = sel.PickObject(ObjectType.Element, new AssemblySelectionfilter(), "Select Assembly"); Element ele = doc.GetElement(ef); AssemblyInstance instance = ele as AssemblyInstance; elesource = ElementtransformToCopy.Elementcopy(doc, instance); dic_element = GetElements(doc, instance); ElementtransformToCopy tr = new ElementtransformToCopy(); IList <Reference> rt = sel.PickObjects(ObjectType.Element, "Select element"); foreach (Reference k in rt) { Element it = doc.GetElement(k); if (it.Category.Name == "Assemblies") { FamilyInstance elementins = ElementtransformToCopy.Elementcopy(doc, it as AssemblyInstance); listtarget.Add(elementins); } else { FamilyInstance ol = it as FamilyInstance; listtarget.Add(ol); } } using (FrmCopyReforcementNotMark form = new FrmCopyReforcementNotMark(this, doc)) { form.ShowDialog(); if (form.listcopy.Count != 0) { tr.CopyElements(doc, elesource, listtarget, form.listcopy); } } //using (FrmCopyReforcementNotMarkWPF form = new FrmCopyReforcementNotMarkWPF(this, doc)) //{ // form.ShowDialog(); // if (form.listcopy.Count != 0) // { // tr.CopyElements(doc, elesource, listtarget, form.listcopy); // } //} return(Result.Succeeded); }