saim Posted July 27, 2017 Share Posted July 27, 2017 Hello. Every project I do have the same set of layers, linetypes and blocks. Since I already have some projects made, I usually open an old one, delete every object in the drawing and save with the name I want. Since I'm learning to create lisps, I thought it would be fun to have one to create those layers and load the blocks into the library. To create the layers is pretty simple - actually the first thing taught to me how to do in a lisp. But to load the blocks seems a bit harder. Searching the internet shown me the command "adcenter". But I can't imagine how I would put, into the lisp, the path to the drawing containing the blocks or the dragging of the block into the drawing. Deleting the block after it has been load is ok, but I think that a lisp should be able to load it without placing it in the drawing to be deleted. Can it be done? In simple commands, since I'm really just beginning this thing? Having the lisp to search for all the blocks availabe at the library-drawing and loading every one of them would be great, but having to type some info of the blocks sounds like simpler for me to understand how it's done. Quote Link to comment Share on other sites More sharing options...
CadJunky Posted July 28, 2017 Share Posted July 28, 2017 Why not just have a "dwt" (Template to have all your blocks, layers, dimstyles etc... so when you start a new drawings it's all there available to you. Or just have all all your blocks, layers, dimstyles etc in a "dwg" file and just insert it into an existing cad drawing. Just use Insert, browse to the cad file with all your settings etc.. click it and then hit the esc key. Quote Link to comment Share on other sites More sharing options...
Commandobill Posted July 28, 2017 Share Posted July 28, 2017 If you don't go the DWT route (which is preferred) try looking into lee's STEAL lisp I use it on various occasions. Quote Link to comment Share on other sites More sharing options...
tombu Posted July 31, 2017 Share Posted July 31, 2017 I'm a big fan of using the right template for every type of drawing and have created an assortment for every purpose. You can also simply insert a template to add layers, linetypes, styles, and blocks. Lee's STEAL routine is on my top 5 list of downloads as it will import almost anything. I added two drop-downs for it, one just for layouts. Adding to both the suggestions above I use above Design Center which allows you to see all the blocks in a separate drawing and insert them with a double-click. A macro with the ADCNAVIGATE command followed by the path to a drawing file will open the drawing in Design Center for you. Quote Link to comment Share on other sites More sharing options...
saim Posted September 8, 2017 Author Share Posted September 8, 2017 Thanks a lot! I have never used a template or checked out what they are meant to. Now, it sounds pretty logical. But since I'm beginning to learn how to program lisps, the "steal" seems very cool, too! Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 8, 2017 Share Posted September 8, 2017 Also "Config" "files" "Template settings" this will set your default DWT as start up etc and New Quote Link to comment Share on other sites More sharing options...
pkenewell Posted September 11, 2017 Share Posted September 11, 2017 Just as an alternative - I use design center. It allows you to pull anything out of a drawing. See the following code. This uses the ADCNAVIGATE command to open Design center at the path you want and toggles the state of the panel: (defun c:DSN ( / usrpath) (setq usrpath "<Your Path to Drawings>") (if (= (getvar "adcstate") 0) (if usrpath (command "._adcnavigate" usrpath)) (command "._adcclose") ) (princ) ) Quote Link to comment Share on other sites More sharing options...
tombu Posted September 13, 2017 Share Posted September 13, 2017 I have a drop-down in a Ribbon Panel to open template drawings using (defun MyOpen (FileName ReadOnly / ) (vla-activate (vla-Open (vla-get-Documents (vlax-get-Acad-Object)) FileName (if ReadOnly :vlax-true :vlax-false) ) ) ) Macro to open the default template: ^C^C^P(or C:MyOpen(load "MyOpen.lsp"));(MyOpen (getenv "QnewTemplate") nil)(princ) To open map2d.dwt: ^C^C^P(or C:MyOpen(load "MyOpen.lsp"));(MyOpen (strcat (getvar "localrootprefix") "template" (chr 92) "AutoCAD Template" (chr 92) "map2d.dwt") nil)(princ) For new drawings using particular template drawings: Using map2d.dwt: ^C^C^P(vla-activate (vla-Add (vla-get-Documents (vlax-get-acad-object)) (strcat (getvar "localrootprefix") "template" (chr 92) "AutoCAD Template" (chr 92) "map2d.dwt"))) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.