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.

 

Martin

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

 

Thanks

 

Martin

 

Share this post


Link to post

From the Function Reference:

 

VS:SetDimNote

 

 

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

Parameters

hHANDLEHandle to dimension.

noteSTRINGNote string.

 

 

Remarks

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


[ao 3/6/14]

Example

SetDimNote(dimHandle,'DLO');

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

 

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.

×