
 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.
  
 
  | Author |    Topic Search  Topic Options | 
 
  | ebrody   Groupie
 
   
 
 Joined: 20.Mar.2014
 Location: United States
 Using: AutoCAD Civil 3D 2013
 Status: Offline
 Points: 26
 |  Topic: Custom command/Macro help Posted: 25.Mar.2014 at 21:05
 | 
 
  | 
   Good advice Kent, I'll take a look into that. For now though, putting that line in the acad21013doc.lsp did indeed work, and it autoloaded it as soon as I fired the command, so I'm happy with that for now. Just got to learn some of the programming syntax for cad commands, and I'm sure ill be rolling along with many-a-custom commands. 
 Thanks for the help! | 
 
  |  | 
 
  | Kent Cooper   Senior Member
 
   
 
 Joined: 12.Mar.2013
 Location: United States
 Using: AutoCAD2020, 2023
 Status: Offline
 Points: 686
 |  Posted: 25.Mar.2014 at 21:02 | 
 
  | 
   >> Found it under acad2013doc.lsp
   I have an older version here, so maybe it's different now, but I assume there's a header with some information, which you should read carefully.  At least in some earlier versions, it is not recommended to edit the acad2xxx.lsp file, but there isn't an acad2xxxdoc.lsp file until some later version than mine, so maybe it's okay to edit that.  If so, yes, you can just add that line anywhere other than inside some other function in it.  If it's not recommended, and you don't have an acaddoc.lsp file already, you can make one, in some folder that's in your Support File Search Path list, even if it contains only that one (autoload) function -- you'll develop other things you want to put in it.  It is run every time a drawing is opened, so things in it are available in all drawings, and maybe that's done with acad2013doc.lsp, too.  The issue is that some related files, like the one you probably have without the doc in its name, may be loaded only once when AutoCAD is started, and not with every drawing that's opened, so commands defined in them won't necessarily be available in all drawings.  So read up on the files and which are loaded when. | 
 
  |  | 
 
  | ebrody   Groupie
 
   
 
 Joined: 20.Mar.2014
 Location: United States
 Using: AutoCAD Civil 3D 2013
 Status: Offline
 Points: 26
 |  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? | 
 
  |  | 
 
  | ebrody   Groupie
 
   
 
 Joined: 20.Mar.2014
 Location: United States
 Using: AutoCAD Civil 3D 2013
 Status: Offline
 Points: 26
 |  Posted: 25.Mar.2014 at 20:16 | 
 
  | 
   Wwhere is the acaddoc.lsp located? 
    | 
 
  |  | 
 
  | Kent Cooper   Senior Member
 
   
 
 Joined: 12.Mar.2013
 Location: United States
 Using: AutoCAD2020, 2023
 Status: Offline
 Points: 686
 |  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
 | 
 
  |  | 
 
  | rs_higgins   Groupie
 
   
 
 Joined: 03.Dec.2013
 Location: United States
 Using: AutoCad 7-2020, SW 14, PRO-E died
 Status: Offline
 Points: 75
 |  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 
     | 
 
  |  | 
 
  | ebrody   Groupie
 
   
 
 Joined: 20.Mar.2014
 Location: United States
 Using: AutoCAD Civil 3D 2013
 Status: Offline
 Points: 26
 |  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? 
 | 
 
  |  | 
 
  | ebrody   Groupie
 
   
 
 Joined: 20.Mar.2014
 Location: United States
 Using: AutoCAD Civil 3D 2013
 Status: Offline
 Points: 26
 |  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! | 
 
  |  | 
 
  | John Connor   Senior Member
 
   
 
 Joined: 01.Feb.2011
 Location: United States
 Using: AutoCAD 2018
 Status: Offline
 Points: 7175
 |  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>>
 
 
 | 
 
  |  | 
 
  | ebrody   Groupie
 
   
 
 Joined: 20.Mar.2014
 Location: United States
 Using: AutoCAD Civil 3D 2013
 Status: Offline
 Points: 26
 |  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?
    | 
 
  |  |