Lisp for line drawing

Hi all,

I was wondering if anyone one knows of a Lisp that would allow me to draw a new line or polyline that automatically draws it in the layer at which the lines start point layer is?

I.E

The current layer is:0

I want to draw line from a point or end of line that is in layer building I want the layer of new line automatically to be drawn in building.. and so on..

Fingers crossed there is such a thing! Thanks

Welcome!

It looks like you're new here. Sign in or register to get started.

Comments

  • The built-in ADDSELECTED is close, but you do need to select the entity first.

    Site faviconADDSELECTED command - BricsCAD | Bricsys Help Center

  • Hi David,

    Thanks for this. I havent used this command before.Youre right, it is close.. but no cigar.

    I like that the command also adopts the points drawing comand I.E. line, arc, polyline..

  • You posted elsewhere also. This was suggestion, add your other post as a link.

    (defun c:testline ( / oldsnap pt ss)
    (setq oldsnap (getvar 'osmode))
    (setvar 'osmode 1)
    (setq pt (getpoint "\nPick start point "))
    (setq ss (ssget pt))
    (setq entlay (cdr (assoc 8 (entget (ssname ss 0)))))
    (setvar 'clayer entlay)
    (command-s "line" pt )
    (setvar 'osmode oldsnap)
    (princ)
    )

  • Hi zero6748

    I think David is right. 'Addselected' is the right tool for this. But it seems you want to reduce clicks and the selected point is the first point of the new entity, so here goes. Try this

    (defun C:test1()
    (setq pt (getpoint "\nSelect entity endpoint"))
    (vl-cmdf "addselected" pt)
    (vl-cmdf pt)
    )

    This will not limit you to one entity type. I have tested it on arcs, circles, plines (all types) and lines

  • Hi VGonsalves,

    Bingo! Thats perfect. Thank you.

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.