Jump to content
Developer Wiki and Function Reference Links ×

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

Link to comment

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.

Link to comment

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 

Link to comment

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.

Link to comment
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

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...