script or lisp to

Discussion in 'AutoCAD' started by WashCaps37, Sep 21, 2004.

  1. WashCaps37

    WashCaps37 Guest

    Hello,

    I have to open up many drawings and extrude a polyline to a certain height (set within the script or lisp) How would one go about writing such a code? because when the extrude command is activated from the command line it asks for the user to select the object to extrude. Any help is appreciated.

    Thanks
     
    WashCaps37, Sep 21, 2004
    #1
  2. WashCaps37

    WashCaps37 Guest

    I forgot to mention that there is only one polyline in each drawing.
     
    WashCaps37, Sep 21, 2004
    #2
  3. WashCaps37

    mantisguy Guest

    If the start point of the polyline is in the same position you could respond to the select object with a co-ordinate point. Or you could use coordinate points to represent a very large window that would guarantee your selection.

    ie at the select point location in your script type the following

    w ;short for window
    c : short for crossing.. might not be needed
    0,0 ;first pick point
    24,24 ;second pick point

    Otherwise you need a lisp routine using the ssget function and filter for the pline
     
    mantisguy, Sep 21, 2004
    #3
  4. WashCaps37

    Jim Claypool Guest

    If there is only one polyline in the drawing, use this instead of the
    extrude command in your script.

    (setq ss (ssget "x" '((0 . "LWPOLYLINE,POLYLINE"))))
    (if ss
    (progn
    (setq ename (ssname ss 0))
    (command ".extrude" ename "" <HEIGHT GOES HERE> "")
    ))
     
    Jim Claypool, Sep 21, 2004
    #4
  5. WashCaps37

    WashCaps37 Guest

    Thank you for your replies.

    Jim, your lisp works great. I tried adding the (defun c: plsel () to your routine but it doesn't work. I get a "Malformed List on Input". Any ideas? I apologize for the easy question but I am a LISP newbie.
     
    WashCaps37, Sep 21, 2004
    #5
  6. WashCaps37

    Jim Claypool Guest

    This works

    (defun c:plsel ()
    (setq ss (ssget "x" '((0 . "LWPOLYLINE,POLYLINE"))))
    (if ss
    (progn
    (setq ename (ssname ss 0))
    ; NOTE: Change the 10 to the desired height
    (command ".extrude" ename "" 10 "")
    ))
    )
     
    Jim Claypool, Sep 21, 2004
    #6
  7. WashCaps37

    liftedaxis Guest

    Depending on how many files you are dealing with, you may be interested in our BatchMan utility, which allows you to run a Lisp routine on any number of files (among many other capabilities).
    http://liftedaxis.com/batchman.html

    --Jeremiah
     
    liftedaxis, Sep 21, 2004
    #7
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.