TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: jtm2020hyo on March 30, 2020, 12:04:49 AM

Title: Insert block with attribute in middle of line with field value.
Post by: jtm2020hyo on March 30, 2020, 12:04:49 AM
I need to insert a block with  ATTRIBUTE( or TEXT, MTEXT, RTEXT, DTEXT) in the middle of the selected lines, but with the field of length, layer, line type, etc. any selected field but of each selected line individually

(https://autodesk.i.lithium.com/t5/image/serverpage/image-id/742806iB3BD83FD6F1E0354/image-size/large?v=1.0&px=999)

related link:  https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-mmp-lisp-to-insert-attribute-text-mtext-rtext-dtext/m-p/9385885#M397369


inspired by Lee Mac: http://www.lee-mac.com/midlen.html

(http://www.lee-mac.com/lisp/gifs/midlen.gif)

attached MMP, a lisp very similar to my request and a drawing with my representation.

PD: if possible use DCL.
Title: Re: Insert block with attribute in middle of line with field value.
Post by: BIGAL on March 30, 2020, 02:54:37 AM
Using a  (vlax-curve-getfirstderiv  obj  (vlax-curve-getparamatpoint you can return the angle at that point so will be tangent to an arc just convert to 90 direction and like Lee check for readability.

So should be able to change lee's code pretty easy.

Code: [Select]
(defun alg-ang (obj pnt)
  (angle '(0. 0. 0.)
     (vlax-curve-getfirstderiv
       obj
       (vlax-curve-getparamatpoint
         obj
         pnt
       )
     )
  )
)
Title: Re: Insert block with attribute in middle of line with field value.
Post by: jtm2020hyo on March 30, 2020, 01:59:19 PM
Using a  (vlax-curve-getfirstderiv  obj  (vlax-curve-getparamatpoint you can return the angle at that point so will be tangent to an arc just convert to 90 direction and like Lee check for readability.

So should be able to change lee's code pretty easy.

Code: [Select]
(defun alg-ang (obj pnt)
  (angle '(0. 0. 0.)
     (vlax-curve-getfirstderiv
       obj
       (vlax-curve-getparamatpoint
         obj
         pnt
       )
     )
  )
)

thanks a lot for your reply. exist any way to insert any type of field related to the polyline? like length, line type, layer, or anything.