+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
  1. #1
    Senior Member brawleyman's Avatar
    Computer Details
    brawleyman's Computer Details
    Operating System:
    Windows 7
    Computer:
    Dell Precision T3500
    CPU:
    Intel Xeon W3530 (4x2.8Ghz)
    RAM:
    12Gb DDR3
    Graphics:
    Nvidia Quadro 600
    Primary Storage:
    250Gb
    Monitor:
    2x Dell Ultrasharp 24" 1920x1080
    Using
    AutoCAD 2013
    Join Date
    Oct 2008
    Location
    Bentonville, AR
    Posts
    103

    Default Macros: How to bypass "invalid keyword option" in a command sequence?

    Is there a macro expression that will allow you to bypass the "invalid keyword option" and continue with a custom macro?

  2. #2
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    I think your macro has wrong syntax. Button macro hasn't any error trap.

  3. #3
    Senior Member brawleyman's Avatar
    Computer Details
    brawleyman's Computer Details
    Operating System:
    Windows 7
    Computer:
    Dell Precision T3500
    CPU:
    Intel Xeon W3530 (4x2.8Ghz)
    RAM:
    12Gb DDR3
    Graphics:
    Nvidia Quadro 600
    Primary Storage:
    250Gb
    Monitor:
    2x Dell Ultrasharp 24" 1920x1080
    Using
    AutoCAD 2013
    Join Date
    Oct 2008
    Location
    Bentonville, AR
    Posts
    103

    Default

    What I have is 2 macros. 1 turns multiple lines into 1 polyline, and the other turns multiple polylines into 1 polyline. I am trying to find a way to fuse the 2 commands together.
    If my selection set has any regular lines in it, 1 macro turns those into polylines then connects them into 1. If my selection set is all polylines, the 2nd macro just connects them together because it doesn't ask to turn them into polylines since they already are.
    I am trying to find a way so that I can use 1 macro to do this. If the selection set happens to have any lines in it, then turn them into polylines then fuse them together, and if the selection set is just polylines, then continue to fuse them.
    I guess it is kind of a "if this condition exists, yes is the answer, then continue the command. If condition does not exist, continue with the command".
    Any ideas?

    ...Edit...Additional info...
    The macros I have created are compound macros that not only fuse the lines together by adding a segment, but also reselects the newly-made polyline and fillets it automatically all in 1 step.

  4. #4
    Forum Deity
    Using
    Civil 3D 2008
    Join Date
    Sep 2006
    Location
    Pittsburgh, PA, USA
    Posts
    3,581

    Default

    Try this, I put it in my acaddoc.lsp file and use it often.
    Code:
    (defun c:pj ()
      (setq pa (getvar "peditaccept"))
      (setvar "peditaccept" 1)
        (setq ssj (ssget))
        (command "pedit" "m" ssj ""  "j" "0.01" "")
      (setvar "peditaccept" pa)
    (princ)
    )

  5. #5
    Senior Member brawleyman's Avatar
    Computer Details
    brawleyman's Computer Details
    Operating System:
    Windows 7
    Computer:
    Dell Precision T3500
    CPU:
    Intel Xeon W3530 (4x2.8Ghz)
    RAM:
    12Gb DDR3
    Graphics:
    Nvidia Quadro 600
    Primary Storage:
    250Gb
    Monitor:
    2x Dell Ultrasharp 24" 1920x1080
    Using
    AutoCAD 2013
    Join Date
    Oct 2008
    Location
    Bentonville, AR
    Posts
    103

    Default

    I am trying to use just the Macro because I am more familiar with it than Lisp, although I am trying to learn it. Essentially, the only difference in the macro code for both macros is the addition of "y:"

    If there are any regular lines, the "y;" tells it "yes, turn into polylines" then continues to create the polyline and fillet it. Otherwise, if they are all polylines, the "y:" makes it say "invalid option keyword" and the macro will not automatically continue the rest of the commands.

    I am trying to make the macro continue past this point so that I can just have the 1 macro to do what I need instead of 2 different ones.

  6. #6
    Senior Member brawleyman's Avatar
    Computer Details
    brawleyman's Computer Details
    Operating System:
    Windows 7
    Computer:
    Dell Precision T3500
    CPU:
    Intel Xeon W3530 (4x2.8Ghz)
    RAM:
    12Gb DDR3
    Graphics:
    Nvidia Quadro 600
    Primary Storage:
    250Gb
    Monitor:
    2x Dell Ultrasharp 24" 1920x1080
    Using
    AutoCAD 2013
    Join Date
    Oct 2008
    Location
    Bentonville, AR
    Posts
    103

    Default

    Oh, another question I have is about repeating the whole operation. If I right click to repeat the command, it just repeats the last part of it, the fillet. I need to be able to repeat the entire command sequence because it would be faster and easier to do that than to have to click on the icon every time.

    I really appreciate your guy's help today. Hopefully there is a way to do what I am wanting to do because I am almost there.

  7. #7
    Forum Deity
    Using
    Civil 3D 2008
    Join Date
    Sep 2006
    Location
    Pittsburgh, PA, USA
    Posts
    3,581

    Default

    Quote Originally Posted by brawleyman View Post
    If there are any regular lines, the "y;" tells it "yes, turn into polylines" then continues to create the polyline and fillet it. Otherwise, if they are all polylines, the "y:" makes it say "invalid option keyword" and the macro will not automatically continue the rest of the commands.

    I am trying to make the macro continue past this point so that I can just have the 1 macro to do what I need instead of 2 different ones.
    Try setting Peditaccept=1, there should be no need for the"Y" prompt.

    A menu macro is essentially a series of commands; when you rt-clk to repeat, acad just repeats the last command executed.

    That being said, here's a lisp that should do what you want
    Code:
    (defun c:test ()
      (setq old-pa (getvar "peditaccept"))
      (setq old-rad (getvar "filletrad"))
      (setvar "peditaccept" 1)
      (setq ent (entsel "\nSelect object to join/fillet: "))
      (setq pt (osnap (cadr ent) "nea"))
      (setq ename (car ent))
      (princ "\nSelect objects to join to: ")
      (setq    ss1 (ssget)
        ssj (ssadd ename ss1)
      )
      (setvar "filletrad" (getreal "Enter radius: "))
      (command "pedit" "m" ssj "" "j" "0.01" "")
      (command "fillet" "p" pt)
      (setvar "peditaccept" old-pa)
      (setvar "filletrad" old-rad)
      (princ)
    )

  8. #8
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2013
    Join Date
    Apr 2008
    Posts
    6,143

    Default

    i wrote this a while back for joining lines, arcs & plines, it will work with either peditaccept setting and will NOT change it.
    Code:
    ;join multiple lines/arcs
    ;created: alan thompson, 4.23.08
    (defun c:mj (/ lines)
     (princ "\nSelect lines & arcs to JOIN: ")
     (setq lines (ssget '((0 . "*LINE,ARC"))))
      (if lines
       (progn
        (if (equal (getvar 'peditaccept) 1)
         (command "pedit" "m" lines "" "j" "" "")
         (command "pedit" "m" lines "" "y" "j" "" "")
        );if
       );progn
       (alert (strcat "\nHey " (getvar "loginname") " it helps if you actually select something to work with!"))
      );if
      (princ)
    );defun

  9. #9
    Senior Member brawleyman's Avatar
    Computer Details
    brawleyman's Computer Details
    Operating System:
    Windows 7
    Computer:
    Dell Precision T3500
    CPU:
    Intel Xeon W3530 (4x2.8Ghz)
    RAM:
    12Gb DDR3
    Graphics:
    Nvidia Quadro 600
    Primary Storage:
    250Gb
    Monitor:
    2x Dell Ultrasharp 24" 1920x1080
    Using
    AutoCAD 2013
    Join Date
    Oct 2008
    Location
    Bentonville, AR
    Posts
    103

    Default

    Thanks lpseifert! I set up my macro to turn peditaccept "on" anytime I use it. I was able to consolidate my 2 commands into 1! Just too bad there wasn't a way to right click to bring up the entire macro command sequence instead of just the last command.

    Thanks everyone for their suggestions!

  10. #10
    Forum Deity
    Using
    Civil 3D 2008
    Join Date
    Sep 2006
    Location
    Pittsburgh, PA, USA
    Posts
    3,581

    Default

    Registered forum members do not see this ad.

    I think if you put an asterisk before the ^C^C in your macro it will repeat.
    But if you use lisp instead of a menu macro, you can define it as an acad command, allowing you to rt-clk to repeat.

Similar Threads

  1. 2004---Command line version of cancel? (As opposed to "Esc")
    By ajs in forum AutoCAD Beginners' Area
    Replies: 6
    Last Post: 18th Nov 2012, 03:53 pm
  2. Line - Point or Option Keyword Required
    By Gracie in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 5
    Last Post: 25th May 2008, 03:17 am
  3. Replies: 0
    Last Post: 16th Sep 2007, 07:40 am
  4. COMMAND "SAVE" Lisp Rountine!
    By lacphong in forum AutoCAD Drawing Management & Output
    Replies: 6
    Last Post: 17th Jun 2007, 04:04 am
  5. funny problem about command "section" in a script
    By phymilton in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 18th Jan 2006, 03:36 am

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