Jump to content

Automatic Draw Polyline From Block To Text/Mtext at Once


Recommended Posts

Posted

maybe Support what you want With an example of a drawing complete

Posted (edited)

Maybe this a quick and dirty

(defun c:wow ( / ss blk inspt inspt2)
(setq blk (entsel "\npick block "))
(setq inspt (cdr (assoc 10 (entget (car blk)))))
(prompt "Select text ")
(setq ss (ssget '((0 . "*TEXT"))))
(if (= ss nil)
 (alert "No plain Text selected ")
 (repeat (setq x (sslength ss))
  (setq ent (ssname ss (setq x (1- x))))
  (setq inspt2 (cdr (assoc 10 (entget ent))))
  (command "line" inspt inspt2 "")
 )
)
(princ)
)

 

Edited by BIGAL
Posted

I have tried with the lisp that you have provided, the results still do not change. 

image.thumb.png.b8e604db9de331c91b69095773040b0a.png

 

Posted
On 9/30/2023 at 11:28 AM, hosneyalaa said:

maybe Support what you want With an example of a drawing complete

I want to create lines or polylines at once, from the same object to different destinations

Posted

Did you pick a block, then Mtext text etc without a dwg to test not sure what is happening.

Posted
17 hours ago, BIGAL said:

Did you pick a block, then Mtext text etc without a dwg to test not sure what is happening.

I have followed the command prompt instructions, and the result is that nothing happens

Posted

Not sure what is wrong, before after

image.thumb.png.bfd128cb1b5cfa2216bbcc67473d6e01.png

 

Maybe something to do with your block post a sample dwg.

Posted (edited)
5 hours ago, BIGAL said:

Not sure what is wrong, before after

image.thumb.png.bfd128cb1b5cfa2216bbcc67473d6e01.png

 

Maybe something to do with your block post a sample dwg.

Edited by zams23
it's solved
Posted
5 hours ago, BIGAL said:

Not sure what is wrong, before after

image.thumb.png.bfd128cb1b5cfa2216bbcc67473d6e01.png

 

Maybe something to do with your block post a sample dwg.

You are so amazing. thank you for helping me. its work 🙏

Posted
On 10/1/2023 at 11:28 AM, BIGAL said:

Maybe this a quick and dirty

(defun c:wow ( / ss blk inspt inspt2)
(setq blk (entsel "\npick block "))
(prompt "Select text ")
(setq inspt (cdr (assoc 10 (entget (car blk)))))
(setq ss (ssget '((0 . "*TEXT"))))
(if (= ss nil)
(alert "No plain Text selected ")
(repeat (setq x (sslength ss))
(setq ent (ssname ss (setq x (1- x))))
(setq inspt2 (cdr (assoc 10 (entget ent))))
(command "line" inspt inspt2 "")
)
)
(princ)
)

 

if i want to change from block to all object, how to change the lisp. 🥹

Posted

You could just pick a point.

; (setq blk (entsel "\npick block "))
(setq inspt (getpoint "\nPick point for end of lines. "))

 

Posted
; 1L - 2023.10.05 exceeds
; draw lines from selected objects to 1 point.

(defun c:1L (/ *error* acdoc ss ssl pt1 index ent pt2 line) 
  (setq acdoc (vla-get-activedocument (vlax-get-acad-object)))
  (defun *error* (msg) 
    (vla-endundomark acdoc)
    (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") 
        (princ (strcat "\n** Error: " msg " **"))
    )
    (princ)
  )
  (vla-endundomark acdoc)
  (vla-startundomark acdoc)
  
  (princ "\n Select Objects to draw line : ")
  (setq ss (ssget))
  (setq ssl (sslength ss))
  (princ "\n Pick origin point : ")
  (setq pt1 (getpoint))
  (princ pt1)
  (setq index 0)
  (repeat ssl 
    (setq ent (ssname ss index))
    (setq pt2 (cdr (assoc 10 (entget ent))))
    (setq line (entmakex 
                 (list (cons 0 "LINE") 
                       (cons 10 (list (car pt1) (cadr pt1) 0.0))
                       (cons 11 (list (car pt2) (cadr pt2) 0.0))
                 )
               )
    )
    (setq index (+ index 1))
  )
  (vla-endundomark acdoc)
  (princ)
)

 

This is what I use.

It can be used with manual selection set,

but it is also good for remembering the selection set

after [Find > SelectAll] or [QSELECT] something.

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