- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hi i'm new in Revit API. I am trying to copy rebars from one wall to another above. It works fine but I have a problem with vector in Copy Elements methods. I thing it gives me normalized vector and i can't thing how to get vector as point without normalize function.
def _rebars(self): rebars = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Rebar).\ WhereElementIsNotElementType() rebarlist = list() for rebar in rebars: rebar_host_id = rebar.GetHostId() if rebar_host_id == self.obj1.Id: rebarlist.append(rebar.Id) self.itemlist = List[ElementId](rebarlist) def _vector(self): point_obj1 = self.obj1.Location.Curve.GetEndPoint(0) point_obj2 = self.obj2.Location.Curve.GetEndPoint(0) self.line = Line.CreateUnbound(point_obj1,point_obj2).Direction self.line2 = (point_obj1-point_obj2).Normalize() print(point_obj1,point_obj2) print(self.line) print(self.line2) def _rcopy(self): self._rebars() self._vector() t = Transaction(doc,"Copy Rebars") t.Start() newrebars = ElementTransformUtils.CopyElements(doc,self.itemlist,self.line) t.Commit()
Solved! Go to Solution.