Jump to content

I need a LISP that will ask me for a layer before drawing ANYTHING


neeboy

Recommended Posts

I posted about this before, but I'm just not getting what I need. I do not know how to program; I am somewhat familiar with AutoLISP commands, but again, I do not know how to write code (which is why i'm posting here).

 

What I what is simple: I want a full AutoLISP routine (a full routine so I can study the structure and maybe learn more about how to do this myself) that will tell AutoCAD to prompt me for a layer name before I draw a line. That simple. Nothing else. Suggesting things like "use a command reactor" don't help me, because I don't know how to write code.

Link to comment
Share on other sites

It's better to be patient and keep on asking in your previous thread which would help you much better than asking your way of instructing our friends in

this marvelous Form to give you what you want as a matter of being servant of yours.

 

Hope you understand my point of view,

 

Your friend Sweety

Link to comment
Share on other sites

Since this post is basically a duplicate of another then I'd ask a moderator delete it.

 

Duplicate posts waste space, divide answers and make following the course of the discussion problematic. If you don't like the answers you have gotten so far then let people know (in a nice way), then either restate the question in a different form and/or provide more detail.

 

Thank you.

 

Now that you got another answer (below) I guess your duplicate posts really need to be combined into one.

 

In the future please do not double post.

Link to comment
Share on other sites

(defun c:XX ()

(setvar "cmdecho" 0)

(command "layer" "s" "DIB" "")

(command "LINE" "FROM POINT" "")

(setvar "cmdecho" 1)

)

 

try this one, in this case, I already have the layer "dib" created, so the moment I write "xx", the layer dib becomes current, so I can draw in this specific layer.

 

To easily create a series of layers you can work with this one:

 

(DEFUN C:MKLAY

()

(COMMAND "LAYER" "M" "DIB" "C" "1" "" "LT" "CONTINUOUS" "" "")

()

(COMMAND "LAYER" "M" "NOT" "C" "1" "" "LT" "CONTINUOUS" "" "")

()

(COMMAND "LAYER" "M" "REF" "C" "1" "" "LT" "CONTINUOUS" "" "")

()

(COMMAND "LAYER" "M" "DIM" "C" "13" "" "LT" "CONTINUOUS" "" "")

()

(COMMAND "LAYER" "M" "HAT" "C" "13" "" "LT" "CONTINUOUS" "" "")

()

(COMMAND "LAYER" "M" "FOR" "C" "1" "" "LT" "CONTINUOUS" "" "")

()

(COMMAND "-STYLE" "STANDARD" "ROMANS" "0.00" "1" "0" "N" "N" "N")

(SETVAR "CMDECHO" 0)

)

Link to comment
Share on other sites

I did set up new toolbar with all kind of different lines and layers and with macro attach to each button there is no mistake when draw req'd line.

All lines will be draw on its own layer.

 

^C^C-la;set;hidden;;_line

 

Red color indicating layer name - change to suit your standard.

I did same thing with dimension - never need to change dimensions to dimension layer.

 

^C^C-la;set;dimension;;_dimlinear

^C^C-la;set;dimension;;_dimaligned etc.

 

Only need to set up template with all layers, line type etc.

ScreenShot033.gif

Link to comment
Share on other sites

This is still not what I'm looking for. I already have routines that will drop objects onto layers automatically when a specific command is invoked.

 

What I want (for example)

 

1) I type "line"

2) A prompt comes up that says "Layer?"

3) I enter the name of a layer

4) AutoCAD switches to that layer and allows me to finish the line command.

 

This way I don't need a bunch of code that automatically drops known types of entities onto pre-defined layers. I start a command, ACAD asks me for a layer, changes to that layer, and allows me to finish the command.

Link to comment
Share on other sites

Building on what has already been said...

 

What I what is simple: I want a full AutoLISP routine (a full routine so I can study the structure and maybe learn more about how to do this myself) that will tell AutoCAD to prompt me for a layer name before I draw a line. That simple. Nothing else. Suggesting things like "use a command reactor" don't help me, because I don't know how to write code.

 

I know you're new to the forums and all, but just to be clear... this is a place for the sharing of knowledge, and not a drive-thru for you to place your order.

 

Reactors can seem intimidating at first, but after learning how to properly use them, they turned out to be one of the simpler concepts that I've learned.

 

If you have trouble writing your code, many of us would be happy to help... but we won't do your work for you.

 

If this is what you really want, then continue to ask for it. However, just so you know, requests such as these (for study or not) are usually ignored.

 

Hope this helps!

Link to comment
Share on other sites

What I want (for example)

 

1) I type "line"

2) A prompt comes up that says "Layer?"

3) I enter the name of a layer

4) AutoCAD switches to that layer and allows me to finish the line command.

 

This way I don't need a bunch of code that automatically drops known types of entities onto pre-defined layers. I start a command, ACAD asks me for a layer, changes to that layer, and allows me to finish the command.

 

BTW - That is exactly what a command reactor would permit you to do.

Link to comment
Share on other sites

You want an intuitive program that doesn't involve a lot of code to anticipate when to prompt you to ask "Layer?". I bet you also want to win the lottery tonight too. By what intelligence does this lightweight, intuitive code know the difference between adding something to a drawing (ex. - line, circle, text, dimension, hatch, xref) and editing something (ex. - erase, mirror, copy, move, stretch, etc.)?

 

I don't need no stinkin command reactor. I'm powered by a miniature nuclear reactor! :twisted::lol:

Link to comment
Share on other sites

Gee, in all that time it took you guys to vent I'm sure you could have written the 10-20 lines of code several times over...guess I'll just learn the language myself and leave you to sit on top of your thrones

Link to comment
Share on other sites

Dear Mr. Neeboy (a.k.a. - Jerk):

 

You could save yourself a lot of grief by using the brain God gave you and the Tools AutoCAD provides simply by using your Tool Palettes. Example. Click on the Draw tab of your Tool Palettes. See the Line command at the top? Right-click on it. This will bring up the Tool Properties window where an dumkopf can change the color, layer, linetype, etc. Make your changes then click on the OK button. Then the next time use the line command from your Tool Palette there is no real thinking involved only doing. You could create your own custom palette and be done with it. So simple even a cave-boy can do it. Now go sulk somewhere else.

Link to comment
Share on other sites

Gee, in all that time it took you guys to vent I'm sure you could have written the 10-20 lines of code several times over...guess I'll just learn the language myself and leave you to sit on top of your thrones

 

 

You are incorrect about several things:

  • We weren't venting, we were actually trying to help you :wink:
  • It wouldn't take me that long to write the code you want 8)
  • My 'throne' lmao :lol:... I was a 'newbie' like you just a few months ago.

That's some sense of entitlement you've got there, dude. I can't wait to see what you're capable of developing when you stop waiting for others to do your work, and write a defun.

Link to comment
Share on other sites

Gee, in all that time it took you guys to vent I'm sure you could have written the 10-20 lines of code several times over...guess I'll just learn the language myself and leave you to sit on top of your thrones

You are right about that. However, you miss the big picture; this is a site for helping, not sitting around like a bunch of monkeys, coding at your whim. We are here on a voluntary basis, so check your attitude and impatience at the virtual door.

 

Oh yeah, and you guys knew it was coming...

popcorn.gif

Link to comment
Share on other sites

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...