Results 1 to 10 of 10

Thread: creating a macro/command button?

  1. #1
    Member
    Join Date
    2009-10
    Posts
    5
    Login to Give a bone
    0

    Default creating a macro/command button?

    Hi, bigtime newcomer to this.
    Summary: An Autolisp function or command button to select all, change colours and to move certain items so much in X & Y.

    Description: I could do with making a macro of some description to basically select all on a drawing, change all the colour to white, then I need to select a certain area change to red (as it’s a security stamp and can only be in red) then I need to select another area on the drawing which is always going to be the same and to move what’s there 2mm to the left and 1mm upwards.

    How Used: I’ve basically got loads of drawings I need to change everything to white so when I create a DWF file our client can read and the stamp will always be in red.
    Last edited by neil.hughes; 2009-11-18 at 11:44 AM. Reason: not laid it how you wanted, sorry...

  2. #2
    Member
    Join Date
    2009-10
    Posts
    5
    Login to Give a bone
    0

    Default Re: creating a macro/command button?

    So far I have this working:
    ^C^C_ai_selall;'_color;

    Basically selecting all in the drawing then the colour menu comes up, I click a colour, press OK, then it returns to the drawing, but the items dont change to the colour i chose.

    Any idea's?

  3. #3
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Question Re: creating a macro/command button?

    Quote Originally Posted by neil.hughes View Post
    Basically selecting all in the drawing then the colour menu comes up, I click a colour, press OK, then it returns to the drawing, but the items dont change to the colour i chose.
    Items in blocks will only change color if their assigned color in the block is BYBLOCK.
    Are the items that are not changing blocks, or other entity types?
    R.K. McSwain | CAD Panacea |

  4. #4
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,421
    Login to Give a bone
    0

    Default Re: creating a macro/command button?

    Quote Originally Posted by neil.hughes View Post
    So far I have this working:
    ^C^C_ai_selall;'_color;

    Basically selecting all in the drawing then the colour menu comes up, I click a colour, press OK, then it returns to the drawing, but the items dont change to the colour i chose.

    Any idea's?
    I've moved this from the api wishlist to the lisp forum. The api wishlist is for modifying objects in the ActiveX api.
    C:> ED WORKING....


    LinkedIn

  5. #5
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: creating a macro/command button?

    Quote Originally Posted by neil.hughes View Post
    So far I have this working:
    ^C^C_ai_selall;'_color;

    Basically selecting all in the drawing then the colour menu comes up, I click a colour, press OK, then it returns to the drawing, but the items dont change to the colour i chose.

    Any idea's?
    The Color command simply sets the current color, it doesn't edit existing entities. For modifications like that you could use the CHANGE command (or in Lisp entmod / vlax properties if you want to go that route)

    You could try using PSelect to have the user select entities for the change to red & move commands. But I'd advise going the Lisp route for this as macros don't always work nicely when user input is required.

    Regarding the stamp & moving area. Are these always on the same place in each drawing? If always the same the selection could also be automated in Lisp.

  6. #6
    Member
    Join Date
    2009-10
    Posts
    5
    Login to Give a bone
    0

    Default Re: creating a macro/command button?

    firstly thanks to all that replied.
    also sorry for putting in wrong forum thread - i wasn't quite sure.
    the red stamp actually is now moving around so - if poss, it would be better if i could actually put a box around it then pick the colour red?
    i'll try and have a mess with the 'COMMAND' and entmod..... - as you can see i'm a complete noob at this.
    don't suppose there's a link to a site with all the commands a small description of what they all do is there online anywhere???

    thanks again for taking time out to reply peeps, much obliged !!!

  7. #7
    Member
    Join Date
    2009-10
    Posts
    5
    Login to Give a bone
    0

    Default Re: creating a macro/command button?

    I've got the following to work so far:
    ^C^C_purge;^C^C_purge;^C^C_Y;^C^C_ai_selall;/^C^C_setbylayer;'_zoom _w ;$M=$(if,$(getvar,cmdactive),,_select; )_w ;

    1 - Load drawing
    2 - Click Icon I created that runs macro above
    3 - Purges twice, then it zooms in (even though zoom is at the end??)
    4 - When its zoomed in it then asks about putting everything to bylayer.... so I say yes & everything turns white - which is all brill so far.

    Then if at all possible -

    1 - I'd like it to have a bit of wording at the bottom that when I press the Icon straight after I'd like it to say - "Press 'Y' to continue" or something like that.
    2 - Also if poss (bit more technical) - is there a way of it remembering the points where i've clicked to zoom in then for it to use those same points to put a box around the stamp that I need to turn red.

    Any idea's peeps - I'll be amazed if I can get this to work!!!

  8. #8
    Member
    Join Date
    2009-10
    Posts
    5
    Login to Give a bone
    0

    Default Re: creating a macro/command button?

    Binned this idea and started again, see below what i changed to make it work:

    1 - I created a script called "test.scr" and placed in my C:\Plotfiles folder.
    It consisted of:
    ;; CREATES A LAYER CALLED STAMP IN RED COLOUR
    _LAYER N STAMP SET STAMP COLOR 1 STAMP
    ;; PUTS EVERYTHING ON DRAWING TO BE SET WITH BYLAYER
    _SETBYLAYER ALL Y Y

    2 - I edited the Macro I created with the following line:
    ^C^C_script
    C:/Plotfiles/test.scr;_laycur;

    So it now basically does what I want.
    Would like a window to pop up to ask whether i'd want to run the macro after I press the button as I could click it on accident - so if anyone could help with that idea, i'd be really grateful.

    Thanks again to those that helped, much appreciated. !!

  9. #9
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: creating a macro/command button?

    For that I think you need to go to Lisp. Create a DCL file to show the dialog and only run the script if the user clicked the Yes or OK button.

  10. #10
    100 Club
    Join Date
    2003-06
    Location
    North Dallas
    Posts
    168
    Login to Give a bone
    0

    Default Re: creating a macro/command button?

    Why use a script file? Add the lines of code to the button on the toolbar.

    ^C^CLAYER N STAMP S STAMP C 1 STAMP ^C^CSETBYLAYER ALL Y Y

    This way you could share the macro with others and also do not have to worry about external files. Also, if you're afraid you'd click it by accident add command undo begin and end so that if you accidentally click it, you can type U and it'll be like it all never happened.


    ^C^CUNDO;BE;LAYER;N;STAMP;S;STAMP;C;1;STAMP;;^C^CSETBYLAYER;ALL;;Y;Y;UNDO;E;
    Last edited by mvsawyer; 2009-12-02 at 07:26 PM.

Similar Threads

  1. Button macro
    By thomas.stright in forum AutoLISP
    Replies: 1
    Last Post: 2009-09-23, 01:45 PM
  2. Button Macro Help
    By ahefner in forum AutoLISP
    Replies: 5
    Last Post: 2007-07-17, 05:10 PM
  3. Replies: 2
    Last Post: 2006-12-05, 03:47 AM
  4. VBA button macro won't run
    By CADKitty in forum VBA/COM Interop
    Replies: 10
    Last Post: 2006-05-25, 07:47 PM
  5. Toolbar button macro repeats last command first
    By SRBalliet in forum AutoCAD Customization
    Replies: 6
    Last Post: 2006-04-03, 11:04 AM

Posting Permissions

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