Jump to content

Lisp for Auto Dimension on selection.


Zulfy

Recommended Posts

Hi everyone,

 

I've been browsing through many threads where people are asking for help with AutoLISP, and I'm hoping someone can assist me as well. I'm not familiar with AutoLISP programming.

 

I'm looking for a tool that can automatically place dimensions in a specific, standard style on selected layers.

 

Here's a specific scenario:

 

I have two layers: one for the "Edge of Pavement" and another for the "Right of Way" of a road. When I run the tool, it should prompt me to choose the layers where these dimensions will be placed.

 

After selecting the layers, the tool should automatically generate two aligned dimensions that are easy to read and understand. These dimensions should be oriented in the direction of the road itself.

 

Note: i've added example below, I request all to pls go thorough for better understanding. 

 

Can anyone help me with this?

After.jpg

Readable angle info.jpeg

Before.jpg

Edited by Zulfy
Add reference images
Link to comment
Share on other sites

I've seen threads on this forum about creating dimensions from line to line. I remember the code was made by @leemac.

If you have time, you can look for a discussion of the code in this forum, I'm sure you will find it.

  • Thanks 1
Link to comment
Share on other sites

Form a coding point of view pick a point on 1st say pline pick second pline draw dim. yes needs some extra like what descriptions to add as 2nd line. Please advise and can do something for choices.

 

(defun c:wow ( / pt1 pt2 pt3 obj obj2)
(setq oldsnap (getvar 'osmode))
(setvar 'osmode 0)
(while (setq ent (entsel "\nPick 1st object Nothing to exit "))
 (setq pt (cadr ent))
 (setq obj (vlax-ename->vla-object (car ent)))
 (setq pt1 (vlax-curve-getclosestpointto obj pt))
 (setq obj2 (vlax-ename->vla-object (car (entsel "\nSelect 2nd object "))))
 (setq pt2 (vlax-curve-getclosestpointto obj2 pt1))
 (command "dim" "aligned" pt1 pt2 pt1 "" "")
)
(setvar 'osmode oldsnap)
(princ)
)
(c:wow)

 

  • Thanks 1
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...