+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Forum Newbie
    Using
    AutoCAD 2012
    Join Date
    Jun 2012
    Posts
    5

    Default Poly lines in lisp

    Registered forum members do not see this ad.

    Hello all,
    Somewhat new at using lisp for a very specific function.
    Here's the issue, I have a lisp routine that needs to save a layerstate, set a specif ic layer current, lock the others, then run the poly line command, exit the pline command, then reset back to the original layer state after running the pline command. Here's the code so far.

    The pline is erroring out before I get to the layer state which are still being developed.

    So main question, can I get the pline command to work properly first.

    Code:
    LOA.LSP	2012 by David W. Erickson
    ;;;  DESCRIPTION
    ;;;
    ;;;  This function turns on a-wall-e layer and locks all non Ioffice layers, sets io-area-indv current and starts the polyline command.
    
    (DEFUN C:LOA  (/ LAYER OFF )
    	(COMMAND "-LAYER" "A" "S" "DAVE" "" "" "" "" )
        	(SETQ pT1 (GETPOINT "\nSelect the 1st POINT. "))
    	(command "-layer" "fr" "*" "th" "io*" "th" "a-*-e" "lo" "*" "unlock" "io*" "set" "io-area-indv" "fr" "a-anno*" "th" "_close_door" "u" "_close_door" "off" "a-door-e" "OFF" "A-FLOR-STRS-E" "OFF" "IO-SEC-SPCS" "OFF" "A-EQPM-E" "")
    	(command "pline" pt1 pause )
    	(COMMAND "-LA" "A" "R" "DAVE" "" "" "" )
    	(COMMAND "-LA" "A" "D" "DAVE" "" "" "" )
    	(princ)
    )
    Thanks in advance.

    Dave
    Last edited by Erickson1026; 24th Jun 2012 at 09:53 pm.

  2. #2
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,008

    Default

    Please try this to dinamically draw the polyline (I didn't checked the rest of the code):
    Code:
    (command "_PLINE")
    (while (> (getvar "CMDACTIVE") 0)
     (command pause)
    )
    Please edit your post and add code tags. Thank you.
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

  3. #3
    Forum Newbie
    Using
    AutoCAD 2012
    Join Date
    Jun 2012
    Posts
    5

    Default

    Revised Code below. I am getting closer. Thanks for the tips and hopefully I wrapped the code appropriately. It works to set the layer and draw the polyline but before I can pick the first point, the "command line dialog" comes and asks to pick the first point, which then requires an additional (2) picks in the drawing editor to initiate the pline. Something simple perhaps.


    Code:
    LOA.LSP	2012 by David W. Erickson
    ;;; DESCRIPTION
    ;;;
    ;;; This function turns on a-wall-e layer and locks all non Ioffice layers, sets io-area-indv current and starts the polyline command.
    
    (DEFUN C:LOA (/ LAYER OFF )
    (COMMAND "-LAYER" "A" "S" "DAVE" "" "")
    (SETQ pT1 (GETPOINT "\nSelect the 1st POINT. "))
    (command "-layer" "fr" "*" "th" "io*" "th" "a-*-e" "lo" "*" "unlock" "io*" "set" "io-area-indv" "fr" "a-anno*" "th" "_close_door" "u" "_close_door" "off" "a-door-e" "OFF" "A-FLOR-STRS-E" "OFF" "IO-SEC-SPCS" "OFF" "A-EQPM-E" "")
    (command "_PLINE")
    (while (> (getvar "CMDACTIVE") 0)
     (command pause)
    (COMMAND "-LAYER" "A" "R" "DAVE" "" "" "")
    (COMMAND "-LAYER" "A" "D" "DAVE" "" "")
    (princ)
    )
    Last edited by Erickson1026; 24th Jun 2012 at 09:54 pm.

  4. #4
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,008

    Default

    Seems that you missed the closing paranthesis for WHILE.
    Code:
    (command "_PLINE")
    (while (> (getvar "CMDACTIVE") 0)
       (command pause)
    )
    Again, please edit your both posts and add code tags.
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

  5. #5
    Forum Newbie
    Using
    AutoCAD 2012
    Join Date
    Jun 2012
    Posts
    5

    Default

    Thanks for that. Figured out code tags this time. Still no luck with extra command line dialog window popping up and extra mouse clicks required to start command.

    Code:
    LOA.LSP	2012 by David W. Erickson
    ;;; DESCRIPTION
    ;;;
    ;;; This function turns on a-wall-e layer and locks all non Ioffice layers, sets io-area-indv current and starts the polyline command.
    
    (DEFUN C:LOA (/ LAYER OFF )
    (COMMAND "-LAYER" "A" "S" "DAVE" "" "" "" "")
    (SETQ pT1 (GETPOINT "\nSelect the 1st POINT. "))
    (command "-layer" "fr" "*" "th" "io*" "th" "a-*-e" "lo" "*" "unlock" "io*" "set" "io-area-indv" "fr" "a-anno*" "th" "_close_door" "u" "_close_door" "off" "a-door-e" "OFF" "A-FLOR-STRS-E" "OFF" "IO-SEC-SPCS" "OFF" "A-EQPM-E" "")
    (command "_PLINE")
    (while (> (getvar "CMDACTIVE") 0)
     (command pause)
    )
    (COMMAND "-LAYER" "A" "R" "DAVE" "" "" "")
    (COMMAND "-LAYER" "A" "D" "DAVE" "" "")
    (princ)
    )

  6. #6
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,008

    Default

    Just noticed that earlier in the code you are asking for a point input; maybe the code should look like:
    Code:
     (command "_PLINE" pT1)
    (while (> (getvar "CMDACTIVE") 0)
     (command pause)
    )
    If it still doesn’t work as expected, then please post here the drawing you will use it in (without content, only for layers three) to test the rest of the code.
    Thank you for edit the first posts, it looks much better now.
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

  7. #7
    Forum Newbie
    Using
    AutoCAD 2012
    Join Date
    Jun 2012
    Posts
    5

    Default

    That worked! Your patience and assistance is much appreciated. This routine will be great to work with for months to come!

    Thanks a million and take care.

    David

  8. #8
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,008

    Default

    Glad to hear that is solved now. You're entirely welcome, David!
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

  9. #9
    Forum Newbie
    Using
    AutoCAD 2012
    Join Date
    Jun 2012
    Posts
    5

    Default

    I actually had to modify it a bit more this morning after getting to work. The previous version worked well the first time through, but then if I ran it again, I was hit with the F2 screen and had to re-pick on the screen to begin the polyline. I added the graphscr commands at a few spots to supress the screen and keep rolling through.

    Again, thanks for your help.

    Code:
     
    ;;;LOA.LSP 2012 by David W. Erickson
    ;;; DESCRIPTION
    ;;;
    ;;; This function turns on a-wall-e layer and locks all non Ioffice layers, sets io-area-indv current and starts the polyline command.
    (DEFUN C:LOA (/ LAYER OFF )
    (COMMAND "-LAYER" "A" "S" "DAVE" "" "" "" "")
    (GRAPHSCR)
    (SETQ pT1 (GETPOINT "\nSelect the 1st POINT. "))
    (GRAPHSCR)
    (command "-layer" "fr" "*" "th" "io*" "th" "a-*-e" "lo" "*" "unlock" "io*" "set" "io-area-indv" "fr" "a-anno*" "th" "_close_door" "u" "_close_door" "off" "a-door-e" "OFF" "A-FLOR-STRS-E" "OFF" "IO-SEC-SPCS" "OFF" "A-EQPM-E" "")
    (command "_PLINE" pt1)
    (while (> (getvar "CMDACTIVE") 0)
    (command pause)
    )
    (GRAPHSCR)
    (COMMAND "-LAYER" "A" "R" "DAVE" "" "" "")
    (COMMAND "-LAYER" "A" "D" "DAVE" "" "")
    (GRAPHSCR)
    (princ)
    )

  10. #10
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,008

    Default

    Registered forum members do not see this ad.

    Try to call the LAYER command like this:
    Code:
    (COMMAND "_LAYER" "_A" "_S" "DAVE" "" "" "" "")
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

Similar Threads

  1. Poly lines
    By skenderbender17 in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 5
    Last Post: 11th Oct 2012, 03:51 pm
  2. Lines to poly line
    By Marktuc in forum AutoCAD Beginners' Area
    Replies: 4
    Last Post: 18th Jun 2012, 08:39 pm
  3. Poly lines
    By skenderbender17 in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 7
    Last Post: 21st Sep 2011, 09:32 pm
  4. fyi - poly lines and pedit
    By bjenk8100 in forum AutoCAD General
    Replies: 2
    Last Post: 4th Jun 2010, 12:47 pm
  5. 3d (poly)lines with width
    By nasko in forum AutoCAD Drawing Management & Output
    Replies: 3
    Last Post: 16th May 2005, 06:20 pm

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts