CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] ARKANCE | CONTACT - CZ | SK | EN | DE
Over 1.099.000 registered users (EN+CZ). AutoCAD tips, Inventor tips, Revit tips. Try the new precise Engineering calculator and the updated Barcode generator. New AutoCAD 2026 commands and variables.
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

?
CAD discussions, advices, exchange of experience

CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.
This is a peer-to-peer forum. The forum doesn't replace the official direct technical support provided by ARKANCE for its customers.
How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedCustom command/Macro help

 Post Reply Post Reply Page  12>
Author
ebrody View Drop Down
Groupie
Groupie


Joined: 20.Mar.2014
Location: United States
Using: AutoCAD Civil 3D 2013
Status: Offline
Points: 26
Direct Link To This Post Topic: Custom command/Macro help
    Posted: 21.Mar.2014 at 23:43
so here is what I am trying to achieve:

I typically like to draw in my P_DIM layer that is set to a different color other than ByLayer. This means that when I am finished drawing and I flip it to the correct layer, it needs to be adjusted to ByLayer for all properties.

I'm trying to create a command that will change THE SELECTED object(s) to ByLayer for Color, Linetype, and Lineweight.

Closest I've found is 
^C^C(setvar “cecolor” “ByLayer”) (setvar “celweight” -1) (setvar “celtype” “ByLayer”)
But this sets the current drawing properties to bylayer for all the above mentioned. Attempting these variables without the ^C^C still sets the current draw type.

Is there a function that I am unable to find to set the color of the current selected object to by layer that I am missing?
Back to Top
Kent Cooper View Drop Down
Senior Member
Senior Member


Joined: 12.Mar.2013
Location: United States
Using: AutoCAD2020, 2023
Status: Offline
Points: 686
Direct Link To This Post Posted: 24.Mar.2014 at 17:11
Here's what I use.  Despite its name, it forces more properties than you mention to BYLAYER and other standard defaults [e.g. Linetype Scale to 1, Thickness to 0], so you may want to edit it to do fewer of them if necessary.  Its BYs command would do what you want [the s is for doing it to a User Selection], but it also contains a BYce command to set all Current-Entity properties in the drawing [and all the other commands include doing that], a BYall command to do it to All objects in the current space, and a BYevery command to do it to Everything in the entire drawing, in all spaces.
 
Back to Top
ebrody View Drop Down
Groupie
Groupie


Joined: 20.Mar.2014
Location: United States
Using: AutoCAD Civil 3D 2013
Status: Offline
Points: 26
Direct Link To This Post Posted: 24.Mar.2014 at 18:41
How should I import that, can I copy the command from opening it as a text file, or is there a method to straight import it into cad as a custom command?
Back to Top
John Connor View Drop Down
Senior Member
Senior Member


Joined: 01.Feb.2011
Location: United States
Using: AutoCAD 2018
Status: Offline
Points: 7175
Direct Link To This Post Posted: 24.Mar.2014 at 19:20
Lisp routines are not imported.  You can use the APPLOAD command to load it or auto-load via the Startup Suite.  You could also make it part of you acad.lsp file.

See this...http://lee-mac.com/runlisp.html


Edited by John Connor - 24.Mar.2014 at 19:21
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."

<<AutoCAD 2015>>

Back to Top
ebrody View Drop Down
Groupie
Groupie


Joined: 20.Mar.2014
Location: United States
Using: AutoCAD Civil 3D 2013
Status: Offline
Points: 26
Direct Link To This Post Posted: 24.Mar.2014 at 19:32
Ok, so correct me if I am wrong on what I just did here.

Apploading that .lsp essentially defines a new command within autoCAD?

Doing so also loads the command line shortcuts you defined within the .lsp

So to get this onto a toolbar, I'd just have to manually add it through customization.

Thanks for the help!
Back to Top
ebrody View Drop Down
Groupie
Groupie


Joined: 20.Mar.2014
Location: United States
Using: AutoCAD Civil 3D 2013
Status: Offline
Points: 26
Direct Link To This Post Posted: 24.Mar.2014 at 19:35
When I just looked at it, when going to customize the toolbars, the functions are not showing in the command list. Is there a way to show them, or would I need to just make a command through macro that just does the "BYce" for instance?

Back to Top
rs_higgins View Drop Down
Groupie
Groupie


Joined: 03.Dec.2013
Location: United States
Using: AutoCad 7-2020, SW 14, PRO-E died
Status: Offline
Points: 75
Direct Link To This Post Posted: 25.Mar.2014 at 14:51
I'm trying to create a command that will change THE SELECTED object(s) to ByLayer for Color, Linetype, and Lineweight.


If I'm reading this right there is a command in AutoCad to do this. "setbylayer" you select the object's you want to change then typ "s" to change the setting if you do not want it all to go to bylayer. answer the next two questions. and your done.

Or select the objects first and type "setbylayer" hit enter twice this will set every thing you selected to by bylayer.






Edited by rs_higgins - 25.Mar.2014 at 15:08
No electrons were harmed in the making of this post. I will admit a few protons were momentarily Inconvenienced
Back to Top
Kent Cooper View Drop Down
Senior Member
Senior Member


Joined: 12.Mar.2013
Location: United States
Using: AutoCAD2020, 2023
Status: Offline
Points: 686
Direct Link To This Post Posted: 25.Mar.2014 at 15:33
>> How should I import that, can I copy the command from opening it as a text file, or is there a method to straight import it into cad as a custom command?
 
Save the file into some folder in your Support File Search Path list in Options.  Type APPLOAD [or just AP], navigate to that location, and load it.
 
If you include this line:
 
(autoload "ByLayer" '("BYce" "BYs" "BYall" "BYevery"))
 
in your acaddoc.lsp file, the commands it defines will be available in any drawing, though the file itself will not be loaded unless and until the User enters one of those command names.
 
You can also make toolbar buttons or other kinds of menu items to invoke the commands.  For instance, to return all current-entity settings to the defaults, you could make a toolbar button that contains:
 
^C^CBYce


Edited by Kent Cooper - 25.Mar.2014 at 15:36
Back to Top
ebrody View Drop Down
Groupie
Groupie


Joined: 20.Mar.2014
Location: United States
Using: AutoCAD Civil 3D 2013
Status: Offline
Points: 26
Direct Link To This Post Posted: 25.Mar.2014 at 20:16
Wwhere is the acaddoc.lsp located? 
Back to Top
ebrody View Drop Down
Groupie
Groupie


Joined: 20.Mar.2014
Location: United States
Using: AutoCAD Civil 3D 2013
Status: Offline
Points: 26
Direct Link To This Post Posted: 25.Mar.2014 at 20:26
Found it under acad2013doc.lsp          

So that command can go anywhere in that text, as in right at the bottom?
Back to Top

Related CAD tips:


 Post Reply Post Reply Page  12>
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,184 seconds.