godofcad Posted April 13, 2012 Posted April 13, 2012 Grettings ... here i have one problem I am tryng to put POINTS to selected "DTEXT" objects if the DTEXT justification is LEFT then it is working ; (setq pos(cdr(assoc 10 (entget(car(entsel)))) ;;; but if the DETXT Justification is MiddleRight,MiddleLeft,Topleft etc. then its not working i mean its showing worng co-ordinates of DTEXT intersection point in "assoc 11" its showing right coordinates ...... How to solve this problem guys ........ Please help ....... Instersection point of DTEXT.dwg Quote
BlackBox Posted April 13, 2012 Posted April 13, 2012 FWIW - (defun c:FOO ( / ss oText typ) (vl-load-com) (princ "\rSelect a text entity: ") (if (and (setq ss (ssget ":S:E:L" '((0 . "*TEXT")))) (setq oText (vlax-ename->vla-object (ssname ss 0)))) (progn (princ "\n >> ") (princ (cond ((vl-position (setq typ (vla-get-objectname oText)) '("AcDbMText" "AcDbText")) (vlax-get oText 'insertionpoint)) ((= typ "RText") (vlax-get oText 'position)))) (terpri)) (prompt "\n** Nothing selected ** ")) (princ)) Quote
Lee Mac Posted April 13, 2012 Posted April 13, 2012 Another: (defun c:tpt ( / e i s ) (if (setq s (ssget '((0 . "TEXT,MTEXT")))) (repeat (setq i (sslength s)) (setq e (entget (ssname s (setq i (1- i))))) (entmake (list '(0 . "POINT") (cons 10 (if (eq "TEXT" (cdr (assoc 0 e))) (if (or (/= 0 (cdr (assoc 72 e))) (/= 0 (cdr (assoc 73 e))) ) (trans (cdr (assoc 11 e)) (cdr (assoc -1 e)) 0) (trans (cdr (assoc 10 e)) (cdr (assoc -1 e)) 0) ) (cdr (assoc 10 e)) ) ) ) ) ) ) (princ) ) Quote
godofcad Posted April 14, 2012 Author Posted April 14, 2012 FWIW - (defun c:FOO ( / ss oText typ) (vl-load-com) (princ "\rSelect a text entity: ") (if (and (setq ss (ssget ":S:E:L" '((0 . "*TEXT")))) (setq oText (vlax-ename->vla-object (ssname ss 0)))) (progn (princ "\n >> ") (princ (cond ((vl-position (setq typ (vla-get-objectname oText)) '("AcDbMText" "AcDbText")) (vlax-get oText 'insertionpoint)) ((= typ "RText") (vlax-get oText 'position)))) (terpri)) (prompt "\n** Nothing selected ** ")) (princ)) Renderman ....its not working . if i change text justification Left to Meddle center .its showing the Deferent co-ordinate value .. Quote
godofcad Posted April 14, 2012 Author Posted April 14, 2012 @ lee mac u got my point ...and its working perfectly ...... i got what i need thank u lee your wonderful ..... :D Quote
BlackBox Posted April 14, 2012 Posted April 14, 2012 Renderman ....its not working . if i change text justification Left to Meddle center .its showing the Deferent co-ordinate value .. Respectfully, it (the code I posted) does exactly what I intended... to return the InsertionPoint, or Position coordinate for AcDBMText, AcDbText, and RText entities respectively. Unfortunately, I do not always post code that is exactly tailored for others' purposes, and in this instance I (incorrectly) anticipated that you would modify the code to suite. In any event, I am glad that you were able to achieve your goal with Lee's help... I've personally learned a lot from Lee... He's a wise, and today and old(-er) man! Cheers, guys! Quote
Lee Mac Posted April 14, 2012 Posted April 14, 2012 @ lee mac u got my point ...and its working perfectly ...... i got what i need thank u lee your wonderful ..... :D You're welcome, though I hope you can learn from the method in my code. Quote
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.