Jump to content

Rotating the text of dimension


DuanJinHui

Recommended Posts

DIMEDIT is built in AutoCAD to rotating the text of dimension to Horizontal or vertical.

 

Yes, 0 , 90,180, 270 degrees is I need. why can't input "0" degrees ? and I don't want input. can dynamic change?

Link to comment
Share on other sites

Yes, 0 , 90,180, 270 degrees is I need. why can't input "0" degrees ? and I don't want input. can dynamic change?

here's is my attempt, i hope you don't mind using mouse as key?

select dimensions -> [enter] -> [L&R] mouse click to rotate

 

HTH

http://www.cadtutor.net/forum/showthread.php?88845-Rotating-the-text-of-dimension

(defun c:test (/ *error* ss ang key rot e *degrees*)
;hanhphuc 24/09/2014
(defun *error* (msg)
 (if (not (wcmatch (strcase msg) "*CANCEL*,*EXIT*"))
   (princ (strcat "\nError: " msg))
   ) ;_ end of if
 (princ)
 ) ;_ end of defun
 
 (setq *degrees* [color="red"]90.[/color]) ; [color="blue"]<--- try change settings here eg: 30. 45. 90. 180. etc.. [/color]
 
 (prompt "\nSelect Dimension, then [ENTER]..")
 (if (and
   (not (zerop *degrees*))
   (setq ss (ssget "_:L" '((0 . "DIMENSION"))))
   ) ;_ end of and
   (setq key t)
   (setq key nil)
   ) ;_ end of if
 (prompt "\nMouse click [L] & [R] to rotate.\n")
 (while key
   (if	(and (setq key (grread nil 10 0))
     (setq
       rot (eval
	     (cons 'cond
		   (reverse
		     (vl-list* '(t (setq key nil))
			       (mapcar ''((a b) (list (list 'equal (car key) a) (/ pi (b (/ 180. *degrees*)))))
				       '(3 25)
				       (list + -)
				       ) ;_ end of mapcar
			       ) ;_ end of cons
		     ) ;_ end of reverse
		   ) ;_ end of cons
	     ) ;_ end of eval
       ) ;_ end of setq
     ) ;_ end of and
     (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
(setq e (vlax-ename->vla-object e))
(vla-put-textrotation e (+ (vla-get-textrotation e) rot))
) ;_ end of foreach
     ) ;_ end of while
   ) ;_ end of while
 (princ)
 ) ;_ end of defun

(princ "\nRotate DIMTEXT by mouse click. command: test")

Link to comment
Share on other sites

here's is my attempt, i hope you don't mind using mouse as key?

select dimensions -> [enter] -> [L&R] mouse click to rotate

 

HTH

 

I really appreciate the help. I haven't tested the code yet, but as soon as I test I let you know.

Link to comment
Share on other sites

here's is my attempt, i hope you don't mind using mouse as key?

select dimensions -> [enter] -> [L&R] mouse click to rotate

 

HTH

 

Cool! I tested yet .Very good! Admire you! Thans a lot ! hanhphuc

Link to comment
Share on other sites

nice code...hopefully it also works with aligned dimensions.

 

one thing i notice is that it changes the Dimension gap?

Edited by nod684
Link to comment
Share on other sites

nice code...hopefully it also works with aligned dimensions.

 

one thing i notice is that it changes the Dimension gap?

i think the gap is measured text's boundingbox, that's why it changes

 

you guys are welcome, just repay i've learned since active in the forums.

Idea was Lee Mac's dynamic oblique text,

EDIT: ISO text , credit to Lee

http://www.theswamp.org/index.php?topic=37429.0

Edited by hanhphuc
found the link
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...