I am trying to do is (as the title specifies) copy, paste in place and change to a different type with python from selected model elements. I have found that “Springs” node does a similar thing but I would like to make the color coded changes in the script.
Unfortunately, I have not got any experience with python and would not know how to do these.
Could anyone please help?.
import clr clr.AddReference('RevitServices') from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager doc = DocumentManager.Instance.CurrentDBDocument clr.AddReference('RevitAPI') from Autodesk.Revit.DB import * from System.Collections.Generic import List clr.AddReference('RevitNodes') import Revit clr.ImportExtensions(Revit.Elements) clr.ImportExtensions(Revit.GeometryConversion) def singleton(x): if hasattr(x,'__iter__'): return x else : return x def tolist(x): if hasattr(x,'__iter__'): return x else : return [x] #Want to change the below source for active view source = UnwrapElement(singleton(IN) ) #Want to change the below dest for active view as well dest = UnwrapElement(singleton(IN) ) #want to change the elements "from IN" should be as simple as swapping "2" for "0" right? elements = UnwrapElement(tolist(IN) ) #Want to swap the type for the new name in "IN" tf1 = singleton(IN) if tf1 is not None: tf1 = tf1.ToTransform(True) eId = List[ElementId](e.Id for e in elements if hasattr(e, "Id") ) TransactionManager.Instance.EnsureInTransaction(doc) copy = ElementTransformUtils.CopyElements(source, eId, dest, tf1, None) TransactionManager.Instance.TransactionTaskDone() OUT = [doc.GetElement(i).ToDSType(False) for i in copy]