Jump to content
Martin Crawford

Replicate Dimension Tool

Recommended Posts

Is it possible to replicate the functionality of the dimension tool with a Python Script.


I need to add a dimension in pixels dependent on a symbol. I would like the ability to add a selection of panel type that would contain the numbers to calculate the pixels. I have this portion of the code working.


I understand how to use the linear plugin to get the dimensions and I have that working, I can draw the lines and arrows and place the final text. What I am having problems with is figuring out how to get the correct offset for placing the text, also it would be cool if I could replicate the ghosting that shows what it will look like prior to clicking where the text goes.


It would extra cool, if I could select the a symbol that it collects the pixel data from to perform the math, and while I know how to get the data, I'm not sure how I can do the selection of the symbol within a linear python script.


Any guidance would be appreciated.



Share this post

Link to post

You could use the Dimension Tool to generate the object, Uncheck the Show Dim Value check box, and put the value you want displayed into the Note, Leader or Trailer field.



Screen Shot 2018-03-16 at 12.16.58 PM.png

Share this post

Link to post

I discovered that trick, what I wasn't able to get it working with python code. I got as far as getting dim in the correct place, however I was unable to figure out how to set the override from python.


I manually drew the lines and the text, and I have it working, the only thing I can't seem to figure out is when creating a linear plug-in, how can I determine starting and ending XY of the line. I know I get the length, and that is useful. If I could get the XY then I should be able to determine what side of the line to place the dimension text.


Currently I am using a control that ask if it is top/bottom/left/right. 


It works, maybe not as elegant as I would like...






Share this post

Link to post

From the Function Reference:





Procedure SetDimNote sets the note text of the referenced dimension to the specified value.


PROCEDURE SetDimNote( h  :HANDLE; note  :STRING);



def vs.SetDimNote(h, note): return None


hHANDLEHandle to dimension.

noteSTRINGNote string.




Sets note text (text under dimension line or dimension text) of the referenced dimension to the specified value.

[ao 3/6/14]



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.


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