Jump to content
Developer Wiki and Function Reference Links Read more... ×
nick@e8urban

Vectorscript Set Z-Value of 3D Polyline

Recommended Posts

Hi All,

 

I'm trying to work through a bunch of contours imported from GIS information. These contours are all sitting on z=0 and all have an elevation value in their records, but there are thousands of separated lines so elevating all by hand is a large job.

 

I have set up some scripts to select these contours separately, but I would like to add to these scripts, by adding a line that sets the z-value of the selection to the elevation value in the record. I don't need it to be smart or anything.. I just want to know a script that can specify a z-value to multiple 3D Polylines.

 

Help?

 

Thank you in advance.

Nick

Mac OSX 10.11.6
Vectorworks Architect 2016

Share this post


Link to post

Hi Josh,

Thank you for your reply. I was looking at move3D, but I wanted something to set the z-value to a definite value. Otherwise I could accidentally run the script twice and ruin myself by compounding mistakes.

Otherwise, I could do this and just be careful, but thats not really my strongest suit..

y'know?

Nick.

Share this post


Link to post

Hi Nick,

 

A 3D poly doesn't really have a single z value you can set, as each vertex has its own z height. You could step through the vertices of each object and use SetPolyPt3D to set the 3D location absolutely. 

 

You could also add a field to your record that you set after moving the each object, and check before moving. 

 

-Josh 

Share this post


Link to post

Hi Josh.

Got it.. I understand this, but when I select a single 3d polyline it allows me to enter a z-value for the whole object (which I assume is the lowest point of a '3D object'), but when multiples are selected I don't have this option. I guess your answer above is the reason why.

I'll take your first suggestion though. I'll just be careful.

Thanks again.

Nick.

Share this post


Link to post
11 hours ago, nick@e8urban said:

when I select a single 3d polyline it allows me to enter a z-value for the whole object (which I assume is the lowest point of a '3D object'), but when multiples are selected I don't have this option.

Actually what you are seeing in object info is the selected 3D vertex.  You use the little black arrows to step through the vertices.  You have the option of moving the whole object to the coordinate specified by the selected vertex.  If all the vertices are coplanar, that effectively sets the z height.

 

Script Wise, that would be the equivalent of:

- Get the coordinates of the first vertex

- Move 3D by negative vertex z

- Move 3D by the new z value.  Or as one statement move by ( newZ - oldZ )

 

-Josh

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×