nck Posted April 27, 2011 Posted April 27, 2011 i was wondering if someone could point me in the correct direction for a lisp. i want to open any existing drawing and automatically apply my custom dimstyle instead of am_ansi, and make it current. i dont want it to change any other dimstyles that are already in the drawing. is this possible? can someone help? thanks Quote
JohnM Posted April 27, 2011 Posted April 27, 2011 what do you mean by apply my dim style? i deal with alot of drawings from architects that i want to usem my dims and layers in. i opened one of my blakn drawings from my template then erased all objects in model ans paper space leaving a total blank drawing except the dim styles text styles and layers then i saved the drawing and called in insert.dwg now when i want to quickly add my stuff to another drawinf i use the insert cammand and select the insert.dwg and that brings in all my stuff. Quote
nck Posted April 27, 2011 Author Posted April 27, 2011 yes i want that to take place but i want it to be when i open the drawing Quote
JohnM Posted April 27, 2011 Posted April 27, 2011 do you have any code started? if so please post it and provide more detail on what you want i will be glad to help but i will not write it for you Quote
SunnyTurtle Posted April 27, 2011 Posted April 27, 2011 Im not sure how to do i when you open the drawing but you can automate the setting of a current dim style by the -dimstyle command and restoring the dim style you want. But not the dim style must all ready be in the drawing you can use JohnM way of doing this as i have also found that the best way. I will try to make a lisp that loads and sets current everytime you open a dwg file but i am still very slow at lisp Quote
nck Posted April 28, 2011 Author Posted April 28, 2011 do you have any code started? if so please post it and provide more detail on what you wanti will be glad to help but i will not write it for you i would not know the first step in making a lisp. thats why im asking questions lol Quote
JohnM Posted April 28, 2011 Posted April 28, 2011 Lisp is not that difficult to learn but you can get as complex as you want Let me get you started: (defun c:test ( ) (alert “Hello World”) );_defun Now read the developers help files on lisp included in your AutoCAD For what you want to do a lisp will only save a couple of clicks. What if you open a drawing that already has everything you need? What if a drawing already has dims,text,and layers named the same as yours? Having a lisp run automatically when you open a drawing is not always a good idea. You can however have the lisp load with each drawing then type the command to run it or make a button to run it. If you use the procedure in my pervious post you can make a button to run it ^C^C –insert “” 0,0 ;; (not tested but close) Quote
nck Posted April 28, 2011 Author Posted April 28, 2011 thanks. ill mess with that more when im at work thursday. Quote
JohnM Posted April 28, 2011 Posted April 28, 2011 If you just learn the very basics of lisp you can create a lot of simple routines that are only a couple of lines long that will save you a great deal of time drawing. I have over a hundred routines that help me along when I need them and if I need something special I just create it even if its just for one job. Quote
SunnyTurtle Posted April 28, 2011 Posted April 28, 2011 create one drawing with the dim style you want an nothing else (lets call is a kind of template) you have to make this save this in autocads search path to do this type -insert randomstuffherethatwillnotbeinyousearchpath and it will tell you the locations autocad looks for files save you drawing in one of those or edit them through the autocad settings Then place this script in you acaddoc.lsp but be carful as this can be dangerious (command "-insert" "a dwg file name within your serch parh that contains the said dim style") (command "-dimstyle" "restore" "name of custom dim style") Quote
SunnyTurtle Posted April 28, 2011 Posted April 28, 2011 http://www.cadtutor.net/forum/showthread.php?21339-How-to-auto-load-LISP-files Another way of automatical loading lisps when autoCAD starts Quote
BlackBox Posted April 28, 2011 Posted April 28, 2011 Im not sure how to do i when you open the drawing Simple... from ACADDOC.lsp: (if (not (tblsearch "dimstyle" "[color=blue]YourDimStyleName[/color]")) ([color=red]YourDimImportFunction[/color])) ** ACADDOC.lsp is a user defined file that, provided it resides within the Support Files Search Paths, will be loaded automatically every time a drawing is opened. Hope this helps! Quote
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.