Jump to content

Can anyone help me? Designing with AutoCAD for 16 years, but never done this...


Recommended Posts

Guest EnvisionMan
Posted

I am almost embarrassed to admit this, but after 16 years of (nearly) full time designing, I still don't know how to do scripts and macros. I have tried several times using YouTube and other instructions, but get lost when it come to writing the script and importing it... nothing I've tried works.

 

So here's what I'd LIKE to do... maybe this is really, really easy? If so can anyone walk me through it step by step? Sorry to ask this of you... I just can't bear to try it again on my own...

 

I want to be able to hit my 0 button (that is a zero) as a command that turns my layer instantly to the zero layer. One of my builders has a lot of stuff in the 0 layer (I modify his plans) so I am constantly having to turn it on. So if I hit and the layer automatically changes to 0.

 

So would that be a script or a Macro? How would I create this?

 

Thank you so much!

Posted

Something like this?

(defun c:0()
(command "_LAYER" "_ON" "0" "_T" "0" "_U" "0" "_S" "0" "")
(princ)
)

Guest EnvisionMan
Posted

So here is where I admit to the full extent of my ignorance... what exactly do I do with the language above? I've tried importing similar scripts in the past with horrible results (and nothing to show for the 2-3 hours of work).

 

I apologize in advance... I am hoping someone can spend a couple minutes and give me step-by-step instructions. I am too frustrated at my own feeble attempts in the past to try again.

 

Thank you in advance!!

Posted

Just paste the code above (AutoLISP) in your command line and a new command named 0 become available. However this will affect only current drawing - to have it available in each drawing, then check Lee's tutorial on automatically loading.

Guest EnvisionMan
Posted

Whoa. How is that I've never seen anything that simple?

 

Are there sites that give out these codes... where you can grab them and apply them to your drawing. This is wild.

Posted
So here is where I admit to the full extent of my ignorance... what exactly do I do with the language above? I've tried importing similar scripts in the past with horrible results (and nothing to show for the 2-3 hours of work).

 

I apologize in advance... I am hoping someone can spend a couple minutes and give me step-by-step instructions. I am too frustrated at my own feeble attempts in the past to try again.

 

Thank you in advance!!

 

Mircea has kindly provided the lisp and link to Lee's excellent site, where you will find a wealth of information and great tools. :beer: :beer:

You might want to start however by copying and pasting everything which Mircea provided into a new NOTEPAD document, and saving it as "Set 0", with filetype .lsp.

Like this ' Set 0 .lsp ' .

Save it on your computer, and remember where you put it, there will be a test shortly.

 

Now just follow Lee's instructions on how to put it in your STARTUP SUITE, for future use.

You will need to specify where it is stored on your computer when adding it to your STARTUP SUITE.

I believe the rest is very well explained in Lee's link.

Good luck, any problem, let us know. :)

Posted (edited)
Whoa. How is that I've never seen anything that simple?

 

Are there sites that give out these codes... where you can grab them and apply them to your drawing. This is wild.

 

Sounds like you got it working, good! :)

 

This is just the tip of the iceberg.

Take a look at ALL of the wonderful tools which Lee has created

(check out Layer Director) and made available on his site.

It is an absolute goldmine of labor saving solutions.

 

Mircea, Lee and a good many other CADTutor forum members (the lisperati) routinely donate their expertise,

time and services to help the rest of us make our work a little more pleasurable and efficient.

 

Hard to believe that just 3 years ago Lee was a newbie on the site!

 

Thanks to you all, you all know who you are! Keep up the good work! :beer: :beer: :beer: :beer:

Edited by Dadgad
Posted

In light of what was no doubt a spiritually uplifting moment, when you saw Mircea's lisp doing what you wanted it to do, :shock:

 

you might want to reassess your lack of faith in yourself, give yourself the benefit of the doubt, and follow this link http://www.lee-mac.com/scriptwriting.html

 

You may see how truly simple it is to create a script for yourself to facilitate the execution of repetitive tasks.

At the end of that link follow the link to SCRIPT WRITER.

Today is the first day of the rest of your CAD life, revel in it. :)

Posted

Further to your same simple theme here is some osnaps settings done the same way with numbers saves having to clear and pick new settings. hint = type "osmode". Our autoload has around 50+ shortcuts. new menu around 200 options. Toolbars 50+ sky's the limit.

 

Also check the file ACAD.PGP has a list of shortcuts.

 

(defun C:15 ()(setvar "osmode" 15359))   ; sets all snaps on
(defun C:39 ()(setvar "osmode" 47))
(defun C:99 ()(setvar "osmode" 99))

Posted
Whoa. How is that I've never seen anything that simple?

 

Are there sites that give out these codes... where you can grab them and apply them to your drawing. This is wild.

 

It would likely be an eyeopener for you to try the ALIASEDIT command, where, if you haven't done it previously you can customize all of your SHORTCALLS (command aliases).

Set them so they make sense to you, it is your workspace after all.

The life (time) you save may be your own! :beer:

Posted

If you have LT, the following macro works - "_Change P la 0;;" - I have it assigned to CTRL+ALT+NUMPAD0.

I have CTRL+NUMPAD0 set to "^C^C-layer m 0;;" which makes the current layer 0.

Posted

Should this be "^C^C-layer m 0;;" "^C^C-layer s 0;;" s for set rather than m "make" implies a new layer to be created Autocad doesn't return an error luckily using m. 2014 ?

Posted

BigGal, you're probably correct, but the routine has worked from LT 2004 - 2013 (if it ain't broke, don't fix it!).

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...