Z-ordinate

Hi using Rhino for Architectural Plans here and we would need a quick method to dimension absolute z-Coordinates in plans.

eg. low/high of slopes for drainage etc.

it seems with evaluatePt Label option I can only get all 3, xyz and also it automatically aligns to the right of where one clicks.

any alternative other than leader with manual input?

cheers,
daniel

@dk2079,

does the _DimOrdinate command help ?

c.

hi Clement,

not really… because it places the dimension always on the cplane and also i need to rotate cplane in order to use z values, as “z-datum” doe not exist.

I would like to evaluatePT any 3d point and drawing a label just showing absolute Z-value

thnx
d.

Hi Daniel,

in order to draw the leader and its text, a plane (or CPlane) would be required. I´m wondering if it would help you to have a command which asks for a point, then gets the Z-Coordinate from it and lets you draw a line. At the end of the line it would then draw a TextDot which you can freely move around and convert to text. (The content would remain static while you move it) ?

c.

Hi Clement,

thanks for your suggestion!
below is the output from revit which I am trying to mimic.
so I thought a leader would be a good idea, although the text would always be in the line not above. Using a dim-style leaves some flexibility concerning later output adjustments.

I get you idea and it would basically do the right thing, although a function that “pastes” the z.coordinate into a leader text-field automatically would be even better I believe.

cheers,
d.

The good thing is that it then uses the text size and plane from the leader. Below script takes the z-value of the leader tip coordinate and pastes it in the text field.

import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
    
def leader_filter(rhino_object, geometry, component_index):
    return isinstance(geometry, Rhino.Geometry.Leader)
    
def LeaderTextToZ(digits=3):
    leader_id = rs.GetObject("select a leader", 0, True, False, leader_filter)
    if not leader_id: return
    
    leader = rs.coercerhinoobject(leader_id, True, True)
    plane = leader.Geometry.Plane.Origin
    value = round(plane.Z, digits)
    
    leader.Geometry.Text = str(value)
    leader.CommitChanges()
    scriptcontext.doc.Views.Redraw()
    
if __name__=="__main__":
    LeaderTextToZ(digits=3)

you can set the number of digits after the decimal point in the last line if the script.

LeaderTextToZ.py (649 Bytes)

c.

=)

Here’s my hack of the morning. If it works, I’ve had coffee, if not then I haven’t, to paraphrase Dale Fugier:

import Rhino
import rhinoscriptsyntax as rs


def test():
    
    while True:
    
        pt = rs.GetPoint()
        if not pt: return
        
        zVal = str(round((pt.Z),3))
        
        rs.Command("_-Leader " + "w" + str(pt)+ " _Pause _Pause _Enter _Enter")
        
        if rs.LastCommandResult() != 0 : return
        
        leaderId = rs.LastCreatedObjects() [0]
        
        rs.LeaderText(leaderId, zVal)
   
test()

-Pascal

The coffee works in your office :wink:

c.

respect.

much appreciated especially the digit control :wink:

this is the macro I am using now (leader with two points), for anyone following this:

cheers,
daniel

ha… missed Pascal’s entry.

very cool stuff.

looks a bit like I should spend my next holiday in a python scripting class.
never got around to that…yet.

cheers,
d.

Hi Guys,

thanks again for your effort!
I have two follow up questions if you happen to still read this thread:

1- is it possible to force a “+” prefix if the values are positive

2- is it possible to force units for the measured point(get meter output for cm document units)

for now I simply added a /100 in the python code, just wondering if there is a “cleaner” way…)

cheers,
daniel

just add this in the script pascal posted:

zVal = str(round((pt.Z),3))
if pt.Z > 0: zVal = "+%s"%zVal

c.

perfect

merci!