Martin Crawford Posted March 16, 2018 Share Posted March 16, 2018 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 Quote Link to comment
Pat Stanford Posted March 16, 2018 Share Posted March 16, 2018 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. Quote Link to comment
Martin Crawford Posted March 16, 2018 Author Share Posted March 16, 2018 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 Quote Link to comment
Pat Stanford Posted March 16, 2018 Share Posted March 16, 2018 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'); Quote Link to comment
Recommended Posts
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.