Make blocks out of custom symbols

Discussion in 'AutoCAD' started by Pierre Marcotte, Jul 21, 2003.

  1. I do mostly graphic symbols from lisp (2D springs, hole centers,
    centerlines, etc.) How can I have my progs create a block out of my symbols
    ? I want the finished product to be a single object, not just a bunch a
    lines. Should I create a temporary layer ? Or can I (cons (entget (car
    (entlast)))) my way through it ? Here's an example of what I do:
    (DEFUN c:2dspring ()
    (SETVAR "cmdecho" 0)
    (SETQ dia (GETREAL "\nSpring diameter : ")
    lon (GETREAL "\nSpring length : ")
    spir (GETINT "\nNumber of spires: ")
    p1 (GETPOINT "\nInsertion point : ")
    p2 (GETPOINT p1 "\nDirection : ")
    dir (ANGLE p1 p2)
    pt1 (POLAR p1 (+ dir (/ PI 2)) (/ dia 2))
    pt2 (POLAR p1 (- dir (/ PI 2)) (/ dia 2))
    sp (/ lon spir)
    top (POLAR pt1 dir (/ sp 2))
    bot (POLAR pt2 dir sp)
    cen (LIST (/ (+ (CAR pt2) (CAR bot)) 2)
    (/ (+ (CADR pt2) (CADR bot)) 2)
    ) ;_ END LIST
    ) ;_ END SETQ
    (SETVAR "osmode" 0)
    (COMMAND "_.pline" pt1 pt2 "")
    (COMMAND "_.line"
    (POLAR pt2 dir lon)
    (POLAR pt1 dir lon)
    ""
    ) ;_ END COMMAND
    (COMMAND "_.pline" pt2 top bot "") ; Creates 1 spire
    (REPEAT (- spir 1) ; Repeats spires
    (COMMAND "_.copy" (ENTLAST) "" pt2 bot)
    (SETQ bot (POLAR pt2 dir sp)
    spir (- spir 1)
    ) ;_ END SETQ
    ) ;_ END
    (SETVAR "osmode" 439)
    ) ;_ END defun

    Thanx a bunch

    Dr Fleau
     
    Pierre Marcotte, Jul 21, 2003
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.