Print Page | Close Window

Makro; Farbe nach Befehl wieder ändern

Printed From: CAD Forum
Category: EN
Forum Name: AutoCAD
Forum Description: Discussion about AutoCAD and AutoCAD LT, viewers, DWG and DXF formats, Design Review, AutoCAD web, Drive, add-ons
URL: https://www.cadforum.cz/forum_en/forum_posts.asp?TID=5365
Printed Date: 05.Sep.2026 at 04:56


Topic: Makro; Farbe nach Befehl wieder ändern
Posted By: papamoik
Subject: Makro; Farbe nach Befehl wieder ändern
Date Posted: 24.Feb.2011 at 14:45
Hallo zusammen
 
Ich möchte die Konstruktionslinien in einer anderen Farbe als der Layerfarbe zeichnen. Dazu wechsle ich im Makro die Farbe. Wie kann ich nun aber nach dem Makro die Farbe wieder auf die Layerfarbe wechseln?
 
mit folgendem Makro funktioniert es nicht, der 2. -farbe Befehl wird einfach ignoriert, da er nach dem Befehlsabruch kommt...
 
^C^C_-layer;se;0;;-farbe;253;_xline;_-farbe;vonlayer;
 
Besten Dnak im Voraus
 
Gruss
papamoik



Replies:
Posted By: John Connor
Date Posted: 24.Feb.2011 at 17:39

You have written a macro and it does not assigned the color to the layer that you have called for.  Is that correct?



-------------
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."

<<AutoCAD 2015>>



Posted By: papamoik
Date Posted: 24.Feb.2011 at 19:13
Hi John
 
I tried to write a macro which does the following steps:
- chang the Layer to Layer 0
- change color to color 253
- start the xline command
 
- after i have drawn the xline the colour should be set to the color of the actual layer (layer 0 here)
 
If I don't do this step, the color is set to 253 even when I chenage the layer for a new line...
 
The last command to change the color back to actual layer doesn't work. Is there a way to implement this command in this macro or do I have to do somesthing else?
 
Thank you
 
best regards
Mike


Posted By: John Connor
Date Posted: 24.Feb.2011 at 20:01
So all you want to do is change the color back to "white" (the original color of layer 0) after you have drawn your Xline using this macro?

-------------
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."

<<AutoCAD 2015>>



Posted By: HAWDesigner
Date Posted: 24.Feb.2011 at 20:50
If you don't want the color to be 253, then remove it from the steps, no?

-------------
--
R. Williams
AutoCAD 2010 Certified Professional
<!-- If all else fails hit F1 -->
<<AutoCAD 2009


Posted By: papamoik
Date Posted: 24.Feb.2011 at 21:12
Hi John
 
You got it!
 
This is what I want. I tried it with the command "-farbe; vonLayer" it means the active layer.
 
Regards
 
Mike


Posted By: papamoik
Date Posted: 24.Feb.2011 at 21:14
Hi HAWDesigner
 
If it was that easy Confused 
 
The construction lines have to be in color 253.
 
Regards
 
Mike


Posted By: John Connor
Date Posted: 24.Feb.2011 at 21:34
Why not create a new layer for your construction lines rather than putting them on layer 0?  That should solve your problem.

-------------
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."

<<AutoCAD 2015>>



Posted By: HAWDesigner
Date Posted: 24.Feb.2011 at 21:43
If you want the color of your construction lines to be 253, then I suggest putting them on a layer with the color dedicated to 253. (As I just realized John also suggested. Wink)

You cannot change the color of a layer, draw an object on that layer, then expect the objects to remain that color when you change the layer color again. Unless, of course, you hard color the objects, in which case, you're not changing the layer properties, you're changing the object properties.


-------------
--
R. Williams
AutoCAD 2010 Certified Professional
<!-- If all else fails hit F1 -->
<<AutoCAD 2009


Posted By: John Connor
Date Posted: 24.Feb.2011 at 22:12
It is not good practice to override your layer properties like color and linetype.  Do what we have suggested.

-------------
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."

<<AutoCAD 2015>>



Posted By: CarlB
Date Posted: 24.Feb.2011 at 23:06

l'll give a suggestion for what you'd like to do and let others advise you what's "proper".

After the "xline" command, you need 2 pauses (backslashes) for the 2 pick points, then an enter to end it. So something like:
 
^C^C_-layer;se;0;;-farbe;253;_xline;\\;_-farbe;vonlayer;


Posted By: papamoik
Date Posted: 25.Feb.2011 at 07:35
Good morning everyone
 
Thank you for your suggestions.
 
I think I create a new layer for my construction lines as mentiond from John and HAWDesigner.
 
CarlB: your solution works for one time, second time it stops underway. But it gives me an idea of commands in macros.
 
 



Print Page | Close Window