Jump to content

Rotated to Aligned dim LISP issue


K Baden

Recommended Posts

Good morning!

 

I am looking at an old LISP my company has, and it would be very useful, BUT for some reason when it replaces the aligned dimension with a rotated dimension, the new dimension bumps out a bit. Can anyone perhaps take a look and see if there's an easy solution to this issue?

 

I want the new dimension to exactly mimic the previous one's placement, rather than bumping it out. maybe it has to do with the text placement point? not sure.

 

Thanks in advance!

 

(defun dtr (a) (* pi (/ a 180.0)))
DTR
(defun c:A2R (/ ss Ent EntData Pt1 Pt2 Pt3 ocmd omode olay odim)
; Redraw dimension that were drawn as aligned as rotated on correct layer, and with correct dimension style.

 (setq ocmd (getvar "cmdecho"))
 (setvar "cmdecho" 0)
 (command "_.undo" "_end")
 (command "_.undo" "_begin")
 (setq old_omode (getvar "osmode"))
 (setvar "osmode" 0)
 (setq olay (getvar "clayer"))
 (setq odim (getvar "dimstyle"))
 (if (setq ss (ssget '((0 . "DIMENSION"))))
   (while (setq Ent (ssname ss 0))
     (setq EntData (entget Ent))
     (if (not (member '(100 . "AcDbRotatedDimension") EntData))
(progn
  (setq Pt1 (cdr (assoc 13 EntData)))
  (setq Pt2 (cdr (assoc 14 EntData)))
  (setq Pt3 (cdr (assoc 11 EntData)))
  (if (< (car Pt1) (car Pt2))
    (command "_.ucs"
	     "_3"
	     Pt1
	     Pt2
	     (polar Pt1
		    (+ (DTR 90) (angle Pt1 Pt2))
		    5
	     )
    )
    (command "_.ucs"
	     "_3"
	     Pt2
	     Pt1
	     (polar Pt2
		    (+ (DTR 90) (angle Pt2 Pt1))
		    5
	     )
    )
  )
  (setvar "clayer" (cdr (assoc 8 EntData)))
  (command "_.dimstyle" "_r" (cdr (assoc 3 EntData)))
  (entdel Ent)
  (command "_.dim"
	   "_horizontal"
	   (trans Pt1 0 1)
	   (trans Pt2 0 1)
	   (trans
	     Pt3
	     0
	     1
	   )
	   ""
	   "_exit"
  )
  (command "_.ucs" "_p")
)
     )
     (ssdel Ent ss)
   )
 )
 (command "_.dimstyle" "_r" odim)
 (command "_.undo" "_end")
 (setvar "clayer" olay)
 (setvar "osmode" old_omode)
 (setvar "cmdecho" ocmd)
 (princ)
)

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