blueshake Posted October 2, 2010 Share Posted October 2, 2010 hi,all the following codes are used to draw a rectangle for text.but it failed. after some debug, I found that box is always nil.can somebody help me thanks. (defun c:drawing_retangle_for_text(/) (setq dd 0.5) (print "\nplease choose the texts.") (setq ss (ssget)) (setq i 0) (repeat (sslength ss) (setq ssn (ssname ss i)) (setq ssdata (entget ssn)) (setq key (cdr (assoc 0 ssdata))) (if (= key "MTEXT") ;then (progn (setq box (textbox ssdata)) (setq p1 (car box)) (setq p3 (cadr box)) (command "_.rectangle" p1 p3 "") ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 2, 2010 Share Posted October 2, 2010 Why not use TCIRCLE from Express Tools? Quote Link to comment Share on other sites More sharing options...
blueshake Posted October 2, 2010 Author Share Posted October 2, 2010 Why not use TCIRCLE from Express Tools? sorry.I don't catch your idea.can you do more explanation?thanks. and here are the worked codes. (defun c:drawing_retangle_for_text(/) vl-load-com (setq dd 0.5) (print "\nplease choose the texts.") ;(setvar "osmode" 0) (setq ss (ssget)) (setq i 0) (repeat (sslength ss) (setq ssn (ssname ss i)) (setq ssdata (entget ssn)) (setq key (cdr (assoc 0 ssdata))) (if (= key "MTEXT") ;then (progn (vla-GetBoundingBox (vlax-ename->vla-object ssn) 'obj1 'obj2) ;(setq p1 (vlax-safearray->list (vlax-variant-value obj1))) ;(setq p3 (vlax-safearray->list (vlax-variant-value obj2))) (setq p1 (safearray-value obj1)) (setq p3 (safearray-value obj2)) ;(print "hi") (command "_.rectangle" p1 p3 "") ;(print "hi") (setq ee (entlast)) (command "_.offset" dd (list ee p1) (polar p3 (/ pi 2) dd) "") (entdel ee) ) ) ) ;(command "ucs" "") (princ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 2, 2010 Share Posted October 2, 2010 If you have Express Tools installed, type TCIRCLE at the command line. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.