Jump to content

Dimension Length in Worksheet


Recommended Posts

I believe this has been asked before: Is there a way to return the length of a dimension to a worksheet?

Interestingly I can report the dimension height, width, x or y center etc. but am stumped to find the call for the dimension value itself.


I'm associating Setback dimensions and would like their values to automatically populate the Zoning Check worksheet.

Edited by bcd
Link to comment

Here is a partial/temporary solution.  As long as you can deal with the returned value being a string, this will work fine. If you need to have the actual value to do calculations on, more work will need to be done,


In the Resource Manager create a new blank script and name it LinDimLength




In a worksheet with a database row with criteria set to Type is Dimension enter a formula in the database header row of:




Note that the name must match the script name and must be encased in single quotes.


This will return the text representation shown in the dimension object.  If you need it as a number, more work will be required because (at least in Feet & Inches), there is a dash between the two parts and this is treated as a minus by all of the string to number routines. So if the text was 12'-3" once you convert it to a number you get 11' 9"


If this script is useful and something you will use often in different files, we can expand on the RunScript line and store the script in the user folder.


Let me know what you think. 

Link to comment

Hi Pat,  Thanks again for this. Nice & speedy & gets the job done!

Yes, I agree - it's a partial/temporary solution to be returning a text string rather than a numeric value, but very effective as far as it goes. Thank you.


Eventually I would like the dimensions to be numeric so that I can perform a logical test on them and flag any nonconforming values. I'll see if I can unpuzzle that one & post back.


It's peculiar how deeply ingrained this is 'num to string' business is throughout the software. I assume for good reason but it's hard to imagine VW forever converting strings back to numbers. I think I heard once that VW calculates everything in mm and converts&presents it in the Users chosen Unit.

I think, per you're parallel wish, we should have system-wide access to the numerical value of fields, without exception. And perhaps instead of a Dimension format for a worksheet cell the user could specify the intended unit. This would do away with the dangerous & clumsy need to add unit marks in the Trailer field. Could it be as simple as the developers giving us access to one more function?


Link to comment
  • 2 months later...

Sorry to take so long to get back to this. Here is the version of the script that will return a numeric value.


Copy and paste the following into a script named LinDimLenAsReal.  Run using =RUNSCRIPT('LinDimLenAsReal').


Procedure LinDimLenAsReal;
{© 2017, Pat Stanford, pat@coviana.com}
{Licensed under the LGPL}
{When used in a Vectorworks Worksheet Script this script will return}
{The numeric value of the dimension string. If the string is in }
{feet and inches with the dash between, it will automatically }
{remove the dash and convert the returned value to inches which}
{can be displayed properly in the worksheet cell}
{Usage Example:                        }
{RunScript('LinDimLenAsReal');      }
{This script will not return proper values for feet&inches if the dim}
{string does not include the dash}
{No Warranty Expressed or Implied. Use at your own risk}

Var	B1:Boolean;
			Insert(' ',S1,N1);
	If N1<>0 then R1:=R1/12;



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.

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