Jump to content

How to find Intersection point of DTEXT object


godofcad

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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! :rofl:

 

Cheers, guys! :beer:

Link to comment
Share on other sites

@ lee mac u got my point ...and its working perfectly ......

 

i got what i need thank u lee your wonderful .....

 

:D:D

 

You're welcome, though I hope you can learn from the method in my code.

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