Jump to content

Recommended Posts

Posted

Can we find out the length of texts by lisp.

text.PNG

Posted

Yes, you can using the Bounding Box Method. It will give you the lower left and upper right coords then you need to calc length and height. Easy if it is at rotation 0 90 180 or 270, slightly more difficult for any other rotation.

Posted
Yes, you can using the Bounding Box Method. It will give you the lower left and upper right coords then you need to calc length and height. Easy if it is at rotation 0 90 180 or 270, slightly more difficult for any other rotation.

 

I have no idea with Bounding Box method. Pl. explane

Posted

Try this

 

(setq util (vla-get-utility 
                  (vla-get-activedocument 
                       (vlax-get-acad-object))))
                       
(vla-getentity util 'obj 'ip "\nSelect Object: ")
(vla-GetBoundingBox obj 'minpoint 'maxpoint)
(setq pointmin (vlax-safearray->list minpoint))
(setq pointmax (vlax-safearray->list maxpoint))
(princ pointmin)(princ "\n")(princ pointmax)

Posted
Try this

 

(setq util (vla-get-utility 
                  (vla-get-activedocument 
                       (vlax-get-acad-object))))
                       
(vla-getentity util 'obj 'ip "\nSelect Object: ")
(vla-GetBoundingBox obj 'minpoint 'maxpoint)
(setq pointmin (vlax-safearray->list minpoint))
(setq pointmax (vlax-safearray->list maxpoint))
(princ pointmin)(princ "\n")(princ pointmax)

 

Thanks for the quick reply.

Posted

Another

(vl-load-com)

(defun c:tw (/ c_doc obj minExt maxExt dist d_ang width ht)
   (setq c_doc (vla-get-ActiveDocument (vlax-get-acad-object))
       obj (vlax-ename->vla-object (car (entsel "\nSelect entity to be object data : ")))
 )
   (vla-GetBoundingBox obj 'minExt 'maxExt)
   (setq dist (distance (vlax-safearray->list minExt) (vlax-safearray->list maxExt))
               d_ang (angle (vlax-safearray->list minExt) (vlax-safearray->list maxExt))
               width (* (cos d_ang) dist)
       ht (* (sin d_ang) dist)
   )
 (princ (strcat "\nWidth = " (rtos width 2) " : Height = " (rtos ht 2)))
);_end_GBB defun
(princ)

Posted

(setq text_list (ssget"C"pt1 pt2  '((0 . "TEXT") ))); list of texts

 

When the texts are inside the selection set . How can I modify above codes.

Posted
(setq text_list (ssget"C"pt1 pt2  '((0 . "TEXT") ))); list of texts

 

When the texts are inside the selection set . How can I modify above codes.

 

 

Was this to me or BIGAL?

 

 

If me, what are you trying to do with the text entities?

Posted

Also for future to reduce confusion, a ssget makes a "Selection set" a "List" is a variable containing a number of values in simple terms.

Posted

Thanks all for your valuable instructions.

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