Jump to content

Recommended Posts

Posted

Quite often I draw lines from many entities at different location to a central origin point.

Instead of drawing them 1 bat a time, Is there a lisp that I can click those entities with the last click for the central origin point like the picture below

 

attachment.php?attachmentid=61137&cid=1&stc=1

Untitled.jpg

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • tive29

    11

  • Tharwat

    8

  • marko_ribar

    2

  • guran

    1

Top Posters In This Topic

Posted Images

Posted

Hi,

 

What are the names of these entities? Points, Blocks, Circles .... etc. So can you list them down here?

Posted

Draw the first line, select line and then the grip point att the end, right click and select copy.

Posted
Hi,

 

What are the names of these entities? Points, Blocks, Circles .... etc. So can you list them down here?

 

Tharwat, to be clearer, its not so much the type of entities, rather it is more like a kind of marker or marking for me or my workers to refer to multiple location in the drawing.

So as an example of how the lisp were to run is (base on the photo in the 1st post)

1)I will be clicking on multiple location in the drawing (1st click, 2nd click, 3rd click & 4th click)

2)for the last click I will click a distance away from all the previous clicks then press ENTER

3)lisp will then draw all the line from all the clicks (1st click to 4th click) to the last click (which will be the central location)

Posted
Draw the first line, select line and then the grip point att the end, right click and select copy.

 

There is no copy option at the grip point.

Posted

Something like this?

 

(defun c:Test (/ int inp pt1 lst pt2)
 ;;  Tharwat - Date: 18.4.2017  ;;
 (setq int 0
       inp '("1st" "2nd" "3rd" "4th" "Base")
 )
 (while
   (and (< int 5)
        (setq pt1 (getpoint (strcat "\nSpecify " (nth int inp) " Point :")))
   )
    (setq int (1+ int)
          lst (cons pt1 lst)
    )
 )
 (and (= (length lst) 5)
      (foreach p (cdr lst) (entmake (list '(0 . "LINE") (cons 10 (car lst)) (cons 11 p)))
      )
 )
 (princ)
)

Posted
There is no copy option at the grip point.

 

Read the post carefully, select the line and then the grip point at the end, RIGHT CLICK and select copy. Instead of the right click you can type C for copy at that point as seen in the command line options after the grip is selected.

Posted

Tharwat, I think you understood it literally... I think that OP means input as much points as needed - while loop is needed and when it's terminated, user should pick base point and then routine should connect all points from stored list of points obtained while looping with base one...

Posted
Tharwat, I think you understood it literally... I think that OP means input as much points as needed - while loop is needed and when it's terminated, user should pick base point and then routine should connect all points from stored list of points obtained while looping with base one...

 

That's exactly what I thought when I was readying the 1st post but it seems that they insist on four points than looping with a base point at the conclusion.

 

Have a read about post# 4

Posted
That's exactly what I thought when I was readying the 1st post but it seems that they insist on four points than looping with a base point at the conclusion.

 

Have a read about post# 4

 

Tharwat, apologies, I meant the 4 clicks as an example. it will be many clicks as marko has mention with the last click as the origin after pressing ENTER.

Posted
Tharwat, apologies, I meant the 4 clicks as an example. it will be many clicks as marko has mention with the last click as the origin after pressing ENTER.

 

No worries at all.

 

(defun c:Test (/ pnt lst bas)
 ;;  Tharwat - Date: 18.4.2017  ;;
 (while (setq pnt (getpoint "\nSpecify Point :"))
   (setq lst (cons pnt lst))
 )
 (and lst
      (setq bas (getpoint "\nSpecify base Point :"))
      (foreach p lst
        (entmake (list '(0 . "LINE") (cons 10 bas) (cons 11 p)))
      )
 )
 (princ)
)

Posted

Tharwat, thats it. Thanks

 

If it is not too much trouble, can there be some kind of point (that will disappear after the lines are drawn) to indicate where I have click before during the lisp routine. That would be helpful as the location of the clicks are plenty & all over the drawing & I may forget that i have click that location before.

 

Thanks

Posted

Why don't you go with a method to select as much points as you want then specify a base point and finally delete all the selected points and draw the lines of course?

 

Is this okay with you?

Posted
Why don't you go with a method to select as much points as you want then specify a base point and finally delete all the selected points and draw the lines of course?

 

Is this okay with you?

 

mmmm... not quite understand what you mean.

Posted
mmmm... not quite understand what you mean.

 

Like the following video:

points.gif

Posted

yea Tharwat. I could work with that. Although I still prefer your last lisp except just missing the visual cues.

Posted
yea Tharwat. I could work with that. Although I still prefer you last lisp except just missing the visual cues.

 

(defun c:Test (/ sel obj lst pts bas)
 ;;  Tharwat - Date: 18.4.2017  ;;
 (princ "\nSelect point objects :")
 (if (setq sel (ssget "_:L" '((0 . "POINT"))))
   (while (setq obj (ssname sel 0))
     (setq lst (cons (cdr (assoc 10 (entget obj))) lst)
           pts (cons obj pts))
     (ssdel obj sel)
     )
   )
 (and lst
      (setq bas (getpoint "\nSpecify base Point :"))
      (foreach p lst
        (entmake (list '(0 . "LINE") (cons 10 bas) (cons 11 p)))
      )
      (mapcar 'entdel pts)
 )
 (princ)
)

Posted

Thanks Tharwat. Will use the 2nd lisp for those complicated ones. :)

Posted
Thanks Tharwat. Will use the 2nd lisp for those complicated ones. :)

 

You have many options now.

Good luck. :)

Posted

tive29, study the variable BLIPMODE... Second Tharwat's code is just fine, just implement BLIPMODE inside code (use getvar to store default value at the beginning, set it to 1, and at the end restore stored value from beginning)...

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