Jump to content

Help with Macro/LISP. Draw lines between two points


Recommended Posts

Posted

Hello everyone.

 

I am looking for a way  to cut down time on redrawing bend lines (marking for laser ). I need to draw marking lines by selecting entity or two points between line with offset "H" from begining and end and length "L" . 

 

image.thumb.png.1094a5b9cff47a0618208df8b47f37fb.png

Posted

Assuming you are dealing with 2D LINE entities only, this could work

 

(defun c:bendl (/ h l ss i en ed p10 p11)

  (or gv_offset (setq gv_offset 1))
  (initget 6)
  (setq h (getdist (strcat "\nOffset Distance <" (rtos gv_offset 2 2) ">:   ")))
  (or h (setq h gv_offset))
  (setq gv_offset h)

  (or gv_length (setq gv_length 1))
  (initget 6)
  (setq l (getdist (strcat "\nLength Distance <" (rtos gv_length 2 2) ">:   ")))
  (or l (setq l gv_length))
  (setq gv_length l)

  (while (setq ss (ssget (list (cons 0 "LINE"))))
         (setq i 0)
         (while (setq en (ssname ss i))
                (setq ed (entget en)
                     p10 (cdr (assoc 10 ed))
                     p11 (cdr (assoc 11 ed)))
                (entmake (list (cons 0 "LINE")
                               (assoc 8 ed)
                               (cons 62 1)
                               (cons 10 (polar p10 (angle p10 p11) h))
                               (cons 11 (polar p10 (angle p10 p11) (+ h l)))))
                 (entmake (list (cons 0 "LINE")
                               (cons 62 1)
                               (cons 10 (polar p11 (angle p11 p10) h))
                               (cons 11 (polar p11 (angle p11 p10) (+ h l)))))
                (setq i (1+ i))))
  (prin1))

 

 

-David

  • Thanks 1
Posted

Thank you David. You saved me alot of time 🙂

Posted

You're welcome.  You could  customize this into a lot of things.  -David

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