vernonlee Posted April 2, 2015 Share Posted April 2, 2015 (edited) Script to insert specific block (base on name) to drawing from a template drawing with many blocks Is that possible? What would the code be written as? I intend to use as a macro & attached it to a button icon. Thanks Edited April 2, 2015 by vernonlee Quote Link to comment Share on other sites More sharing options...
ReMark Posted April 2, 2015 Share Posted April 2, 2015 Isn't that the purpose of the Design center? As an alternative put the block on a custom tool palette. Not every single task requires a lisp or a macro. Quote Link to comment Share on other sites More sharing options...
vernonlee Posted April 2, 2015 Author Share Posted April 2, 2015 Currently using tool palette. But wanted to see if putting it as a button icon would be feasible Quote Link to comment Share on other sites More sharing options...
ReMark Posted April 2, 2015 Share Posted April 2, 2015 Anything is feasible. Do a search on "autocad"+"insert block"+"script" and see what pops up. Quote Link to comment Share on other sites More sharing options...
vernonlee Posted April 2, 2015 Author Share Posted April 2, 2015 Been searching before I posted this though. I will try again over the weekend. Quote Link to comment Share on other sites More sharing options...
tombu Posted April 3, 2015 Share Posted April 3, 2015 The ADCNAVIGATE command can open Design Center with a specific drawing. http://cadtips.cadalyst.com/misc-palettes/open-design-center-specific-folders Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 3, 2015 Share Posted April 3, 2015 The long time favorite Steal.lsp by Lee-mac. Does more than blocks. Quote Link to comment Share on other sites More sharing options...
vernonlee Posted April 4, 2015 Author Share Posted April 4, 2015 (edited) The ADCNAVIGATE command can open Design Center with a specific drawing.http://cadtips.cadalyst.com/misc-palettes/open-design-center-specific-folders Thanks. Will look into that. Unless it's faster than using tool palettes. The long time favorite Steal.lsp by Lee-mac. Does more than blocks. Hi BIGAL. I do use that but for other purposes. For blocks specifically, my daily work routine requires inserting titleblocks which there are 8 different types of titleblock (all in 1 file) depending on the situitation. Current setup is through tool palettes. Which I normally have it closed to maximize screen space. So when I need a titleblock I would have to press ctrl+3 for tool palettes to popout first So I was thinking of having it as an icon with a text script instead. So just press icon, poof! Titleblock will appear. That is what I am planning. Basically I try to arrange all my commands, wherever possible, in a form of an icon or keystroke shortcut since they are the fastest method of execution barring a wormhole "the shortest distance between two points is a straight line" Edited April 4, 2015 by vernonlee Quote Link to comment Share on other sites More sharing options...
vernonlee Posted April 4, 2015 Author Share Posted April 4, 2015 (edited) Basically I try to arrange all my commands, wherever possible, in a form of an icon or keystroke shortcut since they are the fastest method of execution I hope this does not comes across the wrong way but i do like to state that:- Contary to popular belief, I do not always favour LISP nor search or asked here without going through general autocad commands or method first. It does not matter what it is called. Efficiency has always been my deciding factor So hope this dispel any such myth about me. Thanks. Edited April 4, 2015 by vernonlee Quote Link to comment Share on other sites More sharing options...
vernonlee Posted April 4, 2015 Author Share Posted April 4, 2015 (edited) On to the topic at hand, many months back, if i am not mistaken, I THINK ( I carn't confirm) I ever came across on how the scripts is to be writen but for the life of me i could not find it. Edited April 4, 2015 by vernonlee Quote Link to comment Share on other sites More sharing options...
ReMark Posted April 4, 2015 Share Posted April 4, 2015 You must be the most efficient CAD tech in the world then. Quote Link to comment Share on other sites More sharing options...
tombu Posted April 4, 2015 Share Posted April 4, 2015 The long time favorite Steal.lsp by Lee-mac. Does more than blocks. Ranked as one of my top 5 downloads ever! One of the drop-downs in my Ribbon that uses it is for adding layouts from a template. Quote Link to comment Share on other sites More sharing options...
SEANT Posted April 4, 2015 Share Posted April 4, 2015 Script to insert specific block (base on name) to drawing from a template drawing with many blocks Is that possible? What would the code be written as? I intend to use as a macro & attached it to a button icon. Thanks This could be done in an AutoCAD LT compatible manner. For example, this command macro (InsertC): ^C^C_insert;"BlocksABCD";0,0,0;;;;_erase;last;;-insert;"C";\;;; Could be used if the container file “BlocksABCD.dwg” resides in one of the Support File Search Paths. BlocksABCD.dwg Quote Link to comment Share on other sites More sharing options...
vernonlee Posted April 4, 2015 Author Share Posted April 4, 2015 You must be the most efficient CAD tech in the world then. ReMark. Haha. I would not say that. I am just a slow guy trying his best on how to be faster when his supervisor gives her occasional "are you done yet glare" & not get fired. That's all. Quote Link to comment Share on other sites More sharing options...
ReMark Posted April 4, 2015 Share Posted April 4, 2015 Given the amount of time and effort you expend trying to come up with these macros and lisp routines what is the payback? Do you create dozens of new drawings every day wherein a different size title block and border is required to be inserted? Why not have a template file already set up for each of the eight different sizes? Wouldn't that be more efficient? Or, include all of them in one drawing as layouts and delete the ones you know need. Quote Link to comment Share on other sites More sharing options...
vernonlee Posted April 4, 2015 Author Share Posted April 4, 2015 (edited) Given the amount of time and effort you expend trying to come up with these macros and lisp routines what is the payback? Do you create dozens of new drawings every day wherein a different size title block and border is required to be inserted? Why not have a template file already set up for each of the eight different sizes? Wouldn't that be more efficient? Or, include all of them in one drawing as layouts and delete the ones you know need. I only work with existing drawings. My daily routine is to create part print of those drawings. There are about close to a thousand dwg files. Everyday i will be asked to do part print of ONLY certain specific drawings. Part print basically means for me to cloud the changes & do a part view of the drawing instead of the original whole drawings. So since it is now a smaller view, I will also need an apporiate size title block to go with it. Depending on the size of the part view, it can be A1, A2,A3 or A4. All this thousands of drawings do not come with this different sizes of titleblock. They only come in only A0 size. So that is why i need to insert different sizes of titleblock. So the fastest way for me is to insert this title block as blocks. Talking about template. I do have a template. This template contain all this 8 no. of title blocks (they are 2 types hence 2 x 4 = 8 ) as individual block names. So inserting this title block to the existing drawing is the most obivous & direct way I know in this current work situition. Briefly now knowing a little of my work situition, if you do have a faster alternative way, please pray tell. I always keep an open mind. Edited April 4, 2015 by vernonlee Quote Link to comment Share on other sites More sharing options...
vernonlee Posted April 4, 2015 Author Share Posted April 4, 2015 (edited) This could be done in an AutoCAD LT compatible manner. For example, this command macro (InsertC): ^C^C_insert;"BlocksABCD";0,0,0;;;;_erase;last;;-insert;"C";\;;; Could be used if the container file “BlocksABCD.dwg” resides in one of the Support File Search Paths. Hi SEANT. Appreciate the reply. I totally understand what you mean. Did a couple of searches before & I got similar response. The issue is I am not inserting a whole drawing (WBLOCK) as a block. The block I am inserting from is just a block within a drawing file. Example:- 2 drawing files 1) Template.dwg contains A1 block, A2 block, A3 block & A4 block 2) Existing.dwg I require a script that will insert ONLY A3 block from Template.dwg into Existing.dwg. Hope you have an answer for that Also, if anyone is still reading, at this point of time, I am only keen in using scripts to insert this blocks. UNLESS someone can confirm & tell me THAT cannot be done. THEN will give that up & I consider LISP & tie it to a icon shortcut. Thanks Edited April 4, 2015 by vernonlee Quote Link to comment Share on other sites More sharing options...
SEANT Posted April 4, 2015 Share Posted April 4, 2015 That's what that command macro does. Bear in mind, it is a crude example. The file BlocksABCD.dwg contains four block - A, B, C, and D. The macro first inserts the drawing as a block, but immediately deletes it. What that does, though, is load the current drawing with the definitions for that, plus the 4 nested blocks. One of the nested blocks (C, in my example) is then inserted into the drawing. Quote Link to comment Share on other sites More sharing options...
SEANT Posted April 4, 2015 Share Posted April 4, 2015 Granted, the current file will contain definitions that may never be needed, but those can always be eliminated with a call to the Purge command. Quote Link to comment Share on other sites More sharing options...
SEANT Posted April 4, 2015 Share Posted April 4, 2015 I suppose if you preferred to keep the Block Table tidy, the purge could happen within the macro, for example: ^C^C_insert;"BlocksABCD";0,0,0;;;;_erase;last;;-insert;"C";\;;;-purge;b;"BlocksABCD";n;;b;"A";n;;b;"B";n;;b;"D";n; 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.