DB.Floor sketch lines don't update the z-coordinates on copy-paste

DB.Floor sketch lines don't update the z-coordinates on copy-paste

avpBS7DE
Contributor Contributor
656 Views
4 Replies
Message 1 of 5

DB.Floor sketch lines don't update the z-coordinates on copy-paste

avpBS7DE
Contributor
Contributor

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

bug_floors_not_updating.gif



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']




0 Likes
657 Views
4 Replies
Replies (4)
Message 2 of 5

jeremy_tammik
Alumni
Alumni

Maybe the  point coordinates that you retrieve are relative to the floor sketch plane.

 

If the floor sketch plane is at 8 feet, and the points have a Z offset of zero from that plane, then they are indeed located at an elevation of 8 feet, just as you would expect.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 5

avpBS7DE
Contributor
Contributor

Hello Jeremy,

No, I tried that. The Offset parameter does not change the Z coordinate.

I show it in this video.

6eV0i23QOD.gif


You can try to print the same stuff, if you add this line to the script, in my element loop.

print("   height offset %.2fft" % elem.ParametersMap["Height Offset From Level"].AsDouble())


The stats are printed here.

>>> 
Floor-Grnd-Susp_65Scr-80Ins-100Blk-75PC (308848)
   on Level 0 (elev=0.00ft)
   height offset 0.00ft
points (xyz in ft)
['-30.12 16.19 0.00', '17.45 16.19 0.00']
['-30.12 -19.90 0.00', '-30.12 16.19 0.00']
['17.45 -19.90 0.00', '-30.12 -19.90 0.00']
['17.45 16.19 0.00', '17.45 -19.90 0.00']
Floor-Grnd-Susp_65Scr-80Ins-100Blk-75PC (308868)
   on Level 1 (elev=8.00ft)
   height offset 0.00ft
points (xyz in ft)
['-104.89 0.30 0.00', '-57.32 0.30 0.00']
['-104.89 -35.79 0.00', '-104.89 0.30 0.00']
['-57.32 -35.79 0.00', '-104.89 -35.79 0.00']
['-57.32 0.30 0.00', '-57.32 -35.79 0.00']
Floor-Grnd-Susp_65Scr-80Ins-100Blk-75PC (308886)
   on Level 1 (elev=8.00ft)
   height offset 2.00ft
points (xyz in ft)
['-76.92 -43.58 0.00', '-29.35 -43.58 0.00']
['-76.92 -79.67 0.00', '-76.92 -43.58 0.00']
['-29.35 -79.67 0.00', '-76.92 -79.67 0.00']
['-29.35 -43.58 0.00', '-29.35 -79.67 0.00']

 

0 Likes
Message 4 of 5

jeremy_tammik
Alumni
Alumni

Thank you for the confirmation.

  

That supports what I thought. The floor sketch lives on a 2D sketch plane. The sketch plane may or may not be associated with the level. In any case, for a planar horizontal floor, the sketch plane will be a plane with a constant Z elevation. The sketch curve elements all live in that plane, so their coordinates are all pure 2D XY values. Their Z is always zero, meaning, zero offset from the plane that they live in. 

  

That makes sense to me. I cannot guarantee that it is true, but that is my assumption.

    

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 5 of 5

RPTHOMAS108
Mentor
Mentor

Floor elevation is controlled by level elevation and level offset parameters, 2D sketch is for boundary.

Sketched lines often take up the Z value of the level the floor is set to i.e. where the active sketch plane exists.

 

LEVEL_PARAM
(ElemeniId)

 

FLOOR_HEIGHTABOVELEVEL_PARAM
(Double)

 

Offsets from level are also controlled by various other aspects e.g. slope arrow, slab shape editor. However sketch is flat. Otherwise we wonder: 'if we want to draw a ramp is one end of the sketch higher than the other?', no it's not Autocad. You can't really establish much from Z values of sketch, probably only where it was created. These lines appear through every level and in 3D when editing (magenta) so is probably not that important really. Sometimes it is easier to edit in 3D when magenta lines are nearer the plane of the slab I suppose but most would edit slabs on plan.

 

What I always thought would be a good feature is if you had the same sketch defining multiple slabs. As that is essentially how we used to work in 2D (we didn't have so many inconsistencies between levels). These unintentional things tend to creep in more these days. Multiple sources of information for different things which are actually the same but for their elevation.