Jump to content
K Baden

Rotated to Aligned dim LISP issue

Recommended Posts

K Baden

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

Share this post


Link to post
Share on other sites
K Baden

Perhaps there is a way to keep the text position x and y specifically? this is what changes each time

Share this post


Link to post
Share on other sites
Roy_043

Instead of using group code 11 (midpoint of text) you should use group code 10 (definition point).

Share this post


Link to post
Share on other sites
K Baden

This is perfect! I tried a few other group codes with no luck. This one is the one i needed. Thanks a ton!!

Share this post


Link to post
Share on other sites

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

×