Jump to content
Sign in to follow this  

X,Y,Z coordinate to database script?

Recommended Posts

I understand the database features of worksheets.

The question is how do I assign the realtime X,Y,Z coordinates found in the Object Info window of my symbol to a record attachment automatically?

I understand and know how to assign data entry record attachments like "dimmer" or "channel". But realtime X,Y,Z coordinates are different unless I enter them manually based on placement of the fixture. Is there a way to link the realtime X,Y,Z information of the Object Info palette so that the X,Y,Z coordinates are automatically assigned to a record format? Specifically I want to be able to create a database worksheet with this coordinate information for export into 3D visualization software.

Maybe the process is much simpler than I can figure. Is there an existent link from the symbol that is not a record attachment recognizable in the paste function of the worksheet?

Does anyone know of a script or a process?

Greatly appreciated.

Share this post

Link to post

If you're looking for an active link that updates XYZ data as you move an object on screen, that isn't going to happen; however, scripting would allow you to select all the items, run the script and have all that data sent to a worksheet in XY & Z columns.

You could generate a script that reads the XYZ values all your selected symbols (which would be the center of your symbols) and write that data into records which can then be placed into a worksheet.

Share this post

Link to post

Well an example script is certainly the best way to learn, if I have time, I'll try to put together an example for you over the weekend.

There are a multitude of ways to handle it, but the way I would do it would to be create a record with three fields for X, Y, and Z info. I would then select all the symbols that I wanted X,Y, & Z info for and then run the script. The script would go through all the selected symbols one by one and write the X, Y, and Z values into records attached to all the symbols. Once the X, Y, and Z data is in the database record for each symbol, I would create a worksheet that includes the X,Y, and Z fields. This is an overview of how the script would work, but a sample would explain it better I think. Try the following link for some vectorscript exmaples:


Specifically, check out the "intermediate" examples on attaching records to objects. This would be a good start I believe. If I can post some Vectorscript specific to your problem during the weekend, I will.

Share this post

Link to post

Ok, here's the script:



hsymbol :HANDLE;



ZValue :REAL;












For the script to work, you have to create a record called "XYZData" and in that record you have to create 3 text fields "XValue" "YValue" and "ZValue". You could set these fields to number, but most import and export formats for 3D programs read text data fine.

For the script to work, the symbols you need XY & Z data for need to be selected. When you run the script, all it does is write the XYZ value of the center of the symbol into the record attached to that symbol....and of course the record "XYZData" has to be attached to all these symbols too. Of course you can change the name of the record or the name of the field, or adjust the script to whatever record you may attached to your symbols already.

Then if you run a report, you can get all these values into the worksheet and export it. There's some downsides to using the report to get the data into a worksheet, but it's the quickest and easiest. The main problem is that if you have 10 symbols with the same record and you only want 5 of those objects XYZ data, then when you run the report, you'll end up with 10 entries, even though 5 of them may not have XYZ data...but hopefully this will get you in the right direction.

Share this post

Link to post

Similarly, you can link text to record and display the 3 values alongside each symbol. But note that the values here (or in Tom's script) are NOT dynamic. You have to re-run the script whenever you move the objects.

Share this post

Link to post

And THAT is where the danger hides - and the reason for suggesting the PIO option.

Perhaps one could incorporate an update script (using FOREACHOBJECT(doIt, S='locationsymbol')) in a Saved Sheet or a printing command such as my little 'Print and stamp' (date and filename stamps updated, printing launched), but one beautiful day you forget... Well, the latter would be fairly fail-safe if CMD-P would be the shortcut for that and standard Print 'hidden' in a submenu.

Whether one uses PIOs or symbols, there is the additional matter of remembering to recalculate the report.

Share this post

Link to post

Tom, many thanks, this proved to be just the job for the conversion of 20,000 points needed for a large terrain model I have been working on.

Share this post

Link to post


So using this script how would you incorporate referencing to a user set origin.

Call GetSymLoc2D(hsymbol,XValue,YValue); after GetSymLoc3D. GetSymLoc2D should account for a user moved origin.

Share this post

Link to post

Okay, unfortunately I'm really new at the script thing and need a really clear explanation of exactly where it fits in the script.

Share this post

Link to post

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.

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.

Sign in to follow this  


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.

  • Create New...