Message 1 of 5
DB.Floor sketch lines don't update the z-coordinates on copy-paste
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am using an Architectural Project. Create a Floor -> Architectural, and place it (by default) on Level 0 (0 ft tall). I later copy-paste this floor somewhere else, and I assign to it the Level 1 (8 ft tall). I have a macro that extracts its sketch lines, and prints points (in feet). I would expect the z-coordinate of points on the Level 1 floor to be +/- 8.00ft, but they are still 0.0.
Is this a bug ?
I made a video
And this is the script I run on the RevitPythonShell, so you can do the same.
from Autodesk.Revit import DB
uidoc = __revit__.ActiveUIDocument
doc = uidoc.Document
def get_model_lines(elem):
"""
input: elem = DB.Element
output: list of DB.ModelLine (Line or Arc)
"""
sketch_lines = list()
rvt_doc = elem.Document
with DB.Transaction(rvt_doc, "fakedelete") as t:
try:
t.Start()
ids = list(rvt_doc.Delete(elem.Id))
t.RollBack()
sketch_lines.extend([rvt_doc.GetElement(id) for id in ids])
except:
status = t.GetStatus()
if status >= DB.TransactionStatus.Started and \
status != DB.TransactionStatus.RolledBack:
t.RollBack()
return [ml for ml in sketch_lines
if isinstance(ml, DB.ModelCurve) and ml.Name == "Model Lines"]
elems = [doc.GetElement(eid) for eid in uidoc.Selection.GetElementIds()]
for elem in elems:
intId = elem.LevelId.IntegerValue
lev = doc.GetElement(DB.ElementId(intId))
print("%s (%d)" % (elem.Name, elem.Id.IntegerValue))
print(" on %s (elev=%.2fft)" % (lev.Name, lev.Elevation))
print("points (xyz in ft)")
mls = get_model_lines(elem)
for ml in mls:
print(["%.2f %.2f %.2f" % (dbp.X, dbp.Y, dbp.Z)
for dbp in ml.Location.Curve.Tessellate() ])
this is the result of the print
>>>
Floor-Grnd-Susp_65Scr-80Ins-100Blk-75PC (308980)
on Level 0 (elev=0.00ft)
points (xyz in ft)
['14.38 -3.86 0.00', '41.38 -3.86 0.00']
['14.38 38.64 0.00', '14.38 -3.86 0.00']
['41.38 38.64 0.00', '14.38 38.64 0.00']
['41.38 -3.86 0.00', '41.38 38.64 0.00']
Floor-Grnd-Susp_65Scr-80Ins-100Blk-75PC (309000)
on Level 1 (elev=8.00ft)
points (xyz in ft)
['-41.62 -3.86 0.00', '-14.62 -3.86 0.00']
['-41.62 38.64 0.00', '-41.62 -3.86 0.00']
['-14.62 38.64 0.00', '-41.62 38.64 0.00']
['-14.62 -3.86 0.00', '-14.62 38.64 0.00']