Jump to content

Aligned dimension lisp


broncos15

Recommended Posts

I am having an issue with the dimaligned portion of the code. The code runs correctly, but then it gives an error "Unknown command "Dimaligned2"". It seems weird that I am getting the error, but the code still runs. The other issue is that the perpendicular snap is acting really funky (doesn't do it directly across from the place I snapped to). Code is as follows:

(defun C:DIMALIGNED2 ( / pt1 pt2 oldsnap)
 (setq oldsnap (getvar "osmode"))
 (setq pt1 (getpoint "\nSpecify first extension line origin: "))
 (setvar "osmode" 128)
 (setq pt2 (getpoint "\nSpecify second extension line origin: "))
 (command "._DIMALIGNED" pt1 pt2 pause "")
 (prompt "\nDimension Aligned")
 (setvar "osmode" oldsnap)
 (princ)
)

Link to comment
Share on other sites

So after looking at it more closely, I know the issue with the perpendicular portion has to do with the fact that the point 2 isn't associated with point 1, so AutoCAD doesn't know what to do it perpendicular from. I tried to correct it doing the following, but it isn't working.

(defun C:DIMALIGNED2 ( / pt1 oldsnap)
 (setq oldsnap (getvar "osmode"))
 (setq pt1 (getpoint "\nSpecify first extension line origin: "))
 (setvar "osmode" 128)
 (command "._DIMALIGNED" pt1 pause "")
 (prompt "\nDimension Aligned")
 (setvar "osmode" oldsnap)
 (princ)
)

Link to comment
Share on other sites

So after realizing I made a dumb mistake in the last post, I made the corrections. However, I am still having issues where it says the command is unknown after running it, it won't reset my osnaps, and perpendicular is working better, but still giving some issues.

(defun C:DIMALIGNED2 ( / pt1 oldsnap)
 (setq oldsnap (getvar "osmode"))
 (setq pt1 (getpoint "\nSpecify first extension line origin: "))
 (setvar "osmode" 128)
 (command "._DIMALIGNED" pt1 pause pause pause "")
 (prompt "\nDimension Aligned")
 (setvar "osmode" oldsnap)
 (princ)
)

Link to comment
Share on other sites

So I came up with a solution in case anyone wants it. I was just making the code more complex than it needed to be.

(defun c:dimaligned2 ()
 (command "._dimaligned" pause "_perp" pause pause pause "_e")
 )

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