Draw *lines since selected-block-base-point to one picked point

Draw *lines since selected-block-base-point to one picked point

jtm2020hyo
Collaborator Collaborator
1,481 Views
6 Replies
Message 1 of 7

Draw *lines since selected-block-base-point to one picked point

jtm2020hyo
Collaborator
Collaborator

I need a Lisp that can draw polylines  or lines to one picked point (I mean one coordinate, no poupo object ) since selected-blocks-base-points. O since one picked 

0 Likes
Accepted solutions (2)
1,482 Views
6 Replies
Replies (6)
Message 2 of 7

dbhunia
Advisor
Advisor

Hi,

 

Try this

 

(defun C:DL (/)
(Setq selection (entget(car(entsel))))
(Setq p1 (getpoint "\nPick/Enter Piont: "))
(setq IP (cdr (assoc 10 selection)))
(command "line" p1 ip "")
)

Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
Message 3 of 7

Kent1Cooper
Consultant
Consultant
Accepted solution

@jtm2020hyo wrote:

I need a Lisp that can draw polylines  or lines to one picked point ... since selected-blocks-base-points. ….


 

It sounds like you want to draw them from multiple  Blocks.  Does this do what you want?

(defun C:LBP (/ ss pt n); = Line(s) from Block(s) to Point
  (prompt "\nTo draw Line(s) from Block insertion(s) to a point,")
  (setq
    ss (ssget '((0 . "INSERT")))
    pt (getpoint "\nPoint to draw Line(s) to: ")
  ); setq
  (if ss
    (repeat (setq n (sslength ss)); then
      (command "_.line"
        "_none" (cdr (assoc 10 (entget (ssname ss (setq n (1- n))))))
        "_none" pt ""
      ); command
    ); repeat
  ); if
  (princ)
); defun

[Untested.]  Change "_.line" to "_.pline" if you want Polylines instead, but unless they are to have width, I don't see any point in using them.

 

[In some contexts, "from" and "since" are related in meaning, but "from" is the word you want here -- "since" means more like "from in relation to time " rather than in relation to location.]

Kent Cooper, AIA
0 Likes
Message 4 of 7

dbhunia
Advisor
Advisor
Accepted solution

Hi

 

I think @Kent1Cooper is right.... I did not get your point.......

 


@jtm2020hyo wrote:

I need a Lisp that can draw polylines  or lines to one picked point (I mean one coordinate, no poupo object ) since selected-blocks-base-points. O since one picked 


 

In that case I should add/modify few lines in my code ........ try this.....(Actually it works  for single block or  multiple blocks)

 

(defun C:DL (/ sset p1 N IP)
(prompt "\nDraw Line(s) From Block Base Point(s) To a Point")
(Setq sset (ssget '((0 . "INSERT"))))
(Setq p1 (getpoint "\nPick/Enter Piont: "))
(repeat (setq N (sslength sset))
	(setq IP (cdr (assoc 10 (entget (ssname sset (setq N (- N 1)))))))
	(command "_.line" "_none" p1 "_none" ip "");Use "_.pline" for PLINE.
)
(princ)
)

Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes
Message 5 of 7

jtm2020hyo
Collaborator
Collaborator

@Kent1Cooper @dbhunia

My max respect for both.

0 Likes
Message 6 of 7

engc2011e
Observer
Observer

can you change it to work with select to blocks only And Draw Arc with it

0 Likes
Message 7 of 7

Kent1Cooper
Consultant
Consultant

@engc2011e wrote:

can you change it to work with select to blocks only And Draw Arc with it


The routines in this topic are already all designed to work with "INSERT" objects only.  Those can include XREF's, Windows Metafile objects, and even Hatch patterns in very old drawings -- is your request to limit it to Block-reference Insert objects only, ignoring the other kinds?

 

And what do you mean by "Draw Arc with it"?  There are limitless possibilities for what that could be -- post an image or small sample drawing.

Kent Cooper, AIA
0 Likes