Closed S-Rafay-Ali-bukhari closed 1 year ago
collect the wall location curve then locate the point for door insertion
could not use the hardcoded ids you used but it does work this way for example
sel = selection
doc = __revit__.ActiveUIDocument.Document
t = Transaction(doc,"Create Walhhhls")
walls = []
lns = []
t.Start()
for s in sel:
ln = s.GeometryCurve
wall = Wall.Create(doc, ln, ElementId(55663), ElementId(111861), 10, 0, False, False)
walls.append(wall)
lc_w = wall.Location.Curve
lns.append(lc_w)
t.Commit()
t.Start()
door_sym = doc.GetElement(ElementId(241711))
for ln in lns:
pt = ln.Evaluate(0.5, 0)
try:
for wall in walls:
door = doc.Create.NewFamilyInstance(pt, door_sym ,wall, Structure.StructuralType.NonStructural)
except:
pass
t.Commit()
Note, no need to import the revit api modules
Thanks a lot! Do you give classes for teaching coding? I am learning basics however I want to learn advance coding.
Thanks a lot! Do you give classes for teaching coding? I am learning basics however I want to learn advance coding.
@S-Rafay-Ali-bukhari
I do sometimes. You can contact BIMOne inc., the company I work for and ask for a quote if you want.
There is also a lot of free stuff around, I will point you a few:
if you go through all that you will know more than I do probably 😃
The above code is also not working. Can you please help?
It works for my specific revit sample project,
you need to change ElementId(55663), ElementId(111861)
the first one being the walltype id the second the levelId
to grab them use revit lookup tool
https://apidocs.co/apps/revit/2019/6c247699-c8e5-91df-67f7-470d10fa7ba3.htm
This is not an issue for revit python shell, so please close the issue
System.InvalidOperationException: Operation is not valid due to the current state of the object. This is the error I am getting. Placing Doors.txt