+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Full Member
    Using
    AutoCAD 2017
    Join Date
    Oct 2013
    Posts
    62

    Default Rotated to Aligned dim LISP issue

    Registered forum members do not see this ad.

    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!

    Code:
    (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)
    )

  2. #2
    Full Member
    Using
    AutoCAD 2017
    Join Date
    Oct 2013
    Posts
    62

    Default

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

  3. #3
    Super Member
    Using
    not applicable
    Join Date
    Jun 2016
    Posts
    559

    Default

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

  4. #4
    Full Member
    Using
    AutoCAD 2017
    Join Date
    Oct 2013
    Posts
    62

    Default

    Registered forum members do not see this ad.

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

Similar Threads

  1. How to Convert Aligned Dimension to Rotated/Linear Dimension Globally..
    By lonelysn in forum AutoLISP, Visual LISP & DCL
    Replies: 7
    Last Post: 16th Mar 2016, 01:39 pm
  2. Aligned dimension lisp
    By broncos15 in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 20th Oct 2015, 04:21 pm
  3. Aligned Dimensions vs Rotated Dimensions
    By Tyke in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 17
    Last Post: 10th Oct 2013, 01:51 pm
  4. fixoffgrid lisp to work with aligned and rotated dimensions
    By ibach in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 13th Sep 2013, 11:59 pm
  5. Aligned Dimensions to Rotated ?
    By chavlji in forum AutoLISP, Visual LISP & DCL
    Replies: 0
    Last Post: 12th Oct 2009, 10:11 am

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts