See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Some Handy Macros

  1. #1
    Member
    Join Date
    2006-04
    Location
    Dublin. Ireland
    Posts
    9
    Login to Give a bone
    1

    Default Some Handy Macros

    Here's some handy little macros I use in some custom menus and toolbars.

    Open location of current drawing in explorer
    ^C^C^P(startapp "explorer" (strcat "/e, "(getvar "dwgprefix")))(princ);

    Select mid point between two points
    _non;'cal;(cur+cur)/2;

    Saveas 2000
    ^C^C^P(setq odwgname (getvar "dwgname"));(setq xdwgpath (getvar "dwgprefix"));(setq ndwgname (strcat (substr odwgname 1 (- (strlen odwgname) 4))));_saveas;2000;(strcat xdwgpath ndwgname);y;(command "close");y;

    A crude but quick way of removing z values
    C^C_move;_all;;0,0,0;0,0,1e99;_move;_p;;0,0,0;0,0,-1e99;

    Draworder hatch to back
    ^C^C^p(setq ss1 (ssget "x" '((0 . "hatch"))));(command "_draworder" ss1 "" "_b");
    Last edited by dfitzpatrick; 2006-05-11 at 09:53 AM.

  2. #2
    Member girishpongalil's Avatar
    Join Date
    2005-08
    Location
    Dubai, UAE
    Posts
    45
    Login to Give a bone
    0

    Default Re: Some Handy Macros

    Is there any way I can use these macros other than putting in mns file ?

    Useful indeed.

  3. #3
    Certified AUGI Addict jaberwok's Avatar
    Join Date
    2000-12
    Location
    0,0,0 The Origin
    Posts
    8,570
    Login to Give a bone
    0

    Default Re: Some Handy Macros

    Quote Originally Posted by girishpongalil
    Is there any way I can use these macros other than putting in mns file ?

    Useful indeed.

    Macros are usually applied to buttons. You can create buttons without manually editing any file but the method varies according to the version of acad involved.

  4. #4
    AUGI Addict Augi Doggie's Avatar
    Join Date
    2002-01
    Location
    Orlando, FL.
    Posts
    1,348
    Login to Give a bone
    0

    Default Re: Some Handy Macros

    I absolutely love the Explorer one!

    The Midpoint Between Two Points macro is great for 2004 or earlier users. But I should point out that Midpoint Between Two Points (M2P) is available in AutoCAD 2005 and above as a OSnap.

    In 2007 you can use the OSnap by entering either MTP or M2P.

  5. #5
    AUGI Addict madcadder's Avatar
    Join Date
    2000-11
    Location
    Too far from the beach
    Posts
    1,054
    Login to Give a bone
    0

    Default Re: Some Handy Macros

    This is probably the one I use the most for working views, saving views, center viewports, etc.

    Code:
    ;;; by Pat Starkey, AUGI LISP Guild, 07/13/01
    ;;; Zooms to the extents of the current display 
    (defun c:zde (/ |displayextents|)
      (setvar "cmdecho" 0)
      (setq	|displayextents|
    	 (acet-geom-ss-extents
    	   (ssget "c" (getvar "vsmin") (getvar "vsmax"))
    	   t
    	 )
      )
      (command "zoom"
    	   "w"
    	   (car |displayextents|)
    	   (cadr |displayextents|)
      )
      (setvar "cmdecho" 1)
      (princ)
    )

  6. #6
    Member
    Join Date
    2006-04
    Location
    Dublin. Ireland
    Posts
    9
    Login to Give a bone
    0

    Default Re: Some Handy Macros

    Quote Originally Posted by Augi Doggie
    I absolutely love the Explorer one!

    The Midpoint Between Two Points macro is great for 2004 or earlier users. But I should point out that Midpoint Between Two Points (M2P) is available in AutoCAD 2005 and above as a OSnap.

    In 2007 you can use the OSnap by entering either MTP or M2P.
    Yeah I should have pointed that out, I'm still using 2004 in work unfortunately.

  7. #7
    Member
    Join Date
    2006-05
    Posts
    5
    Login to Give a bone
    0

    Question Re: Some Handy Macros

    hey everyone! first post here..

    i was browsing through and i found this sweet little script:

    " Open location of current drawing in explorer
    ^C^C^P(startapp "explorer" (strcat "/e, "(getvar^M;"dwgprefix")))(princ); "

    that works great, and i shared it with some guys in the office, and they were asking me to find a way to make another macro to open a certain folder in explorer, like a shortcut. we were wondering how to make a button to open explorer then browse to our personal folder. the directory is " K:\SDeily "

    i have been attempting to do this myself but lack very much programming experience. the closest i could get on my own was with this:

    " ^C^C^P(startapp "explorer")(princ); "

    this script only opens the default explorer directory of 'my documents'.
    any help here would be much appreciated! thanks

  8. #8
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,100
    Login to Give a bone
    0

    Default Re: Some Handy Macros

    Quote Originally Posted by drinkamonster
    hey everyone! first post here..

    i was browsing through and i found this sweet little script:

    " Open location of current drawing in explorer
    ^C^C^P(startapp "explorer" (strcat "/e, "(getvar^M;"dwgprefix")))(princ); "

    that works great, and i shared it with some guys in the office, and they were asking me to find a way to make another macro to open a certain folder in explorer, like a shortcut. we were wondering how to make a button to open explorer then browse to our personal folder. the directory is " K:\SDeily "

    i have been attempting to do this myself but lack very much programming experience. the closest i could get on my own was with this:

    " ^C^C^P(startapp "explorer")(princ); "

    this script only opens the default explorer directory of 'my documents'.
    any help here would be much appreciated! thanks
    What is your user name for ACAD? Is SDeily it? Then try this code.
    Code:
    ^C^C^P(startapp "explorer" (strcat "/e, k:\\" (getvar "loginname")))(princ); "
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  9. #9
    Member
    Join Date
    2006-05
    Posts
    5
    Login to Give a bone
    0

    Default Re: Some Handy Macros

    Quote Originally Posted by Opie
    What is your user name for ACAD? Is SDeily it? Then try this code.
    Code:
    ^C^C^P(startapp "explorer" (strcat "/e, k:\\" (getvar "loginname")))(princ); "
    i'm not sure what you mean by user name for ACAD.. i don't have to log in to that or anything. the script you sent didn't seem to do anything. is there a way to replace the "getvar" with something like an insert or run command to a certain directory?

  10. #10
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,100
    Login to Give a bone
    0

    Default Re: Some Handy Macros

    Quote Originally Posted by drinkamonster
    i'm not sure what you mean by user name for ACAD.. i don't have to log in to that or anything. the script you sent didn't seem to do anything. is there a way to replace the "getvar" with something like an insert or run command to a certain directory?
    Yes, it can be changed to pretty much anything.

    Is SDeily the same folder for everyone?
    Code:
    ^C^C^P(startapp "explorer" "/e, k:\\SDeilly")(princ);
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

Page 1 of 2 12 LastLast

Similar Threads

  1. Macros, Macros, Macros...
    By stusic in forum AutoCAD Tips & Tricks
    Replies: 2
    Last Post: 2007-11-08, 07:48 PM
  2. Oops - they dropped a handy feature
    By narlee in forum Revit Architecture - General
    Replies: 0
    Last Post: 2004-10-27, 06:11 PM

Posting Permissions

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