Jump to content
Developer Wiki and Function Reference Links Read more... ×
Sign in to follow this  
sle7en7

Script to Call the Width & Height of a Rectangle

Recommended Posts

I was messing with worksheets again to create an areas table with length and width listed but do not want to put the information manually because I'm... umm LAZY, but fell short of the task basically.

So after searching the forum a bit, I was unable to find a way to call the Width/Height of a rectangle in a database header. Is there a way to do this (like punching in "=S" to call a symbol's name) or is this information not stored as a default data like area, perimeter or ratio?

Thanks for all the help in advance. :blush:

Share this post


Link to post

Would you believe =Width and =Height?

There are two places to look that will give you all the possible database calls.

1. In VW help search for Retrieving Object Attributes in a Worksheet. That will give you all the cool things like =S for symbol or =T for Type, etc.

2. In the worksheet, click the little triangle under the red X. In the pull down choose Paste Function? That will give you a list of all possible calls.

hth

mk

Share this post


Link to post

Be careful with the Width and Height commands. They refer to the projection onto the screen, not the object itself.

They will work fine if you are working with rectangles that are parallel or perpendicular to the screen, but as soon as you have a rectangle rotated a few degrees it will not give you the dimensions of the rectangle, but rather of the bounding box you would get if you converted the rectangle to a polygon.

=Height - Returns the delta Y (height) of objects

=Width - Returns the delta X (width) of objects

Share this post


Link to post

Not that I know of.

Sorry,

Actually, since this is the Vectorscript forum, the information is valuable with the HHeight and HWidth functions of a script. At least for Rectangles and Ovals which is all I tested this morning.

If you then needed that data in a worksheet you could write a script that would attach a custom Record Format to each object and use the above functions to store the VS HHeight and HWidth into the record which could be accessed with a record.field function in the worksheet.

The problem is that you would have to remember to run the script every time you changed an object with the attached record.

Edited by Pat Stanford

Share this post


Link to post

Thank you for the heads up Pat.

You think you can send a file with the script you just mentioned? I'm kind of lost at this point but I believe what I'm trying to do is to define the edges of a rectangle in terms of delta Y (height) and delta X (width), so I guess we will write a script in order to accomplish this?

Share this post


Link to post

I just posted an example script on the Vectorscript Sharing forum.

https://techboard.vectorworks.net/ubbthreads.php?ubb=showflat&Number=202373Post202373

Note that this has the same limitations as the rest of VW when it comes to how rectangles are oriented. If your rectangles are rotated after you create them, the Width and Height may not be what you expect them to be, but the two values will be correct.

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
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.

×