Mica Posted February 9, 2012 Share Posted February 9, 2012 Deal all, I am new at this forum and I have one question. Can I make VBA macro (application) for insertnig blocks? I need to insert blocks from list of blocks that I made. I want to use less time with that application on inserting blocks, then to use standard method Insert>Block... So I want to check the block from my list, to deffine attributes and to put the block automatically on drawing, and then to repeat all with another and another blocks. all to be put one close to other. I hope that you understand me. Kind regards Quote Link to comment Share on other sites More sharing options...
MSasu Posted February 9, 2012 Share Posted February 9, 2012 The answer is yes; please keep in mind that you may automate most of the operations that you perform manually in AutoCAD. However, since you are using AutoCAD 2012 please take care that the VBA is no longer supported from version 2010, thus you can download and install an enabler from Autodesk site. To avoid issues in future I suggest you to look for an AutoLISP or .Net approach. May be useful to ask a moderator to move your post on customization area of the Forum. And, by the way, welcome to the Forum! Regards, Mircea Quote Link to comment Share on other sites More sharing options...
Mica Posted February 9, 2012 Author Share Posted February 9, 2012 Thank you Mircea for quick reply. I allready install VBA, because I read a little before posting here, so I had an idea that I it can be done by using VBA. But you are right, it's better to use something that regullary goes with AutoCAD. Can I create macro with AutoLISP? Regards, Milan Quote Link to comment Share on other sites More sharing options...
MSasu Posted February 9, 2012 Share Posted February 9, 2012 Can I create macro with AutoLISP? Yes, a routine with the specifications from your first post can be developed in AutoLISP. I suggest you to follow some AutoLISP tutorials, try to code your routine and post here first attempt; will try to help you debug it. May also search on the Forum for similar tools and start your routine by modifying one of those to suits your requirements. Good luck! Regards, Mircea Quote Link to comment Share on other sites More sharing options...
Mica Posted February 9, 2012 Author Share Posted February 9, 2012 Thank you again Mircea. I need this for my master thesis. If you are electrical engeener you will understand next. If you are not, you will understend enough, so you can give an answer if you want. I want to make something like Simaris Sivacon. So I have one more question for now. When I put block bus bar (simple line), with 5 positions, and I want to put block transformer on position 3, can I do that? Can I make positions in block and than use base point of another block to join two blocks? For now I want to know is it possible at all with my resources (knowlege about LISP=0, time for all little more than one month). Regards, Milan Quote Link to comment Share on other sites More sharing options...
MSasu Posted February 10, 2012 Share Posted February 10, 2012 Milan, if you are already familiar with VBA and this is just a school project, then is far better to go with VBA. But, if decide to choose the AutoLISP solution, then I keep my offer to assist you in your development. Just post your progress here. To get familiar with AutoLISP you may check: http://lee-mac.com/ http://www.afralisp.net/autolisp/ Regards, Mircea Quote Link to comment Share on other sites More sharing options...
Mica Posted February 10, 2012 Author Share Posted February 10, 2012 Thanks again Mircea. I want to use LISP. I allready started with reading 2nd one, and because you suggested it also, I will continue. I will inform you about my progress. Regards, Milan Quote Link to comment Share on other sites More sharing options...
MSasu Posted February 10, 2012 Share Posted February 10, 2012 I want to use LISP. In this case should ask a moderator to move this thread in AutoLISP sub-forum; this way will gain better visibility and support. Regards, Mircea Quote Link to comment Share on other sites More sharing options...
Mica Posted February 10, 2012 Author Share Posted February 10, 2012 I don't know how. Regards, Milan Quote Link to comment Share on other sites More sharing options...
MSasu Posted February 10, 2012 Share Posted February 10, 2012 You can check here. Regards, Mircea Quote Link to comment Share on other sites More sharing options...
dbroada Posted February 10, 2012 Share Posted February 10, 2012 since you have palettes why don't you use them? Set ATTREQ=0 and set the default attributes to your most used values and all you need do is drag the block from the palette. Quote Link to comment Share on other sites More sharing options...
Mica Posted February 10, 2012 Author Share Posted February 10, 2012 I was thinking on, because I am new, I cannot send personal messages. I found that on http://www.cadtutor.net/forum/showthread.php?56184, maybe I'm wrong. Regards, Milan Quote Link to comment Share on other sites More sharing options...
Mica Posted February 10, 2012 Author Share Posted February 10, 2012 Thanks Dave, maybe I will use your idea. I am new in this and I have a lots of ideas, so now I will try to find what is fit for me the best, and for my mentors. Regards, Milan Quote Link to comment Share on other sites More sharing options...
Mica Posted February 10, 2012 Author Share Posted February 10, 2012 Dave, I want to ask you about what you said. Can I create my own blocks and my own palettes which consists of my blocks? And if the answer is yes, how can I create icons for the palettes? Are the icons look like a bloks, but small versions, or I must to draw icons separately? Or it can be both? And can I use one icon in my palette for a few blocks? I saw you are electrical engeener so in this case I want to use e.g. one icon for transformers (two windings, three windings, auto transformers...). Regards, Milan Quote Link to comment Share on other sites More sharing options...
dbroada Posted February 10, 2012 Share Posted February 10, 2012 Mica, You can create your own blocks with attributes easily enough. If you pre-set the attributes (I'm off sick today so this is from memory) those values will be filled in unless overrridden. The ATTREQ=0 means you won't see the dialogue box (set ATTREQ=1 to display the dialogue on insert) unless you double click the block where you can change any attributes you like. You should create all your blocks in one drawing and put this drawing somewhere safe - maybe a "Symbols" folder. Right clicking on a palette should allow you tio create your own new palette. Drag each block onto the palette from your master drawing. The icons are created automatically. Now each block can be inserted into other drawings by clicking on the icon on the palette. I am actually a mechanical engineer but we use ACADE. I am OK on 24v wiring but not so good on other things! I group my similar items in their own area or on their own palette. The other thing you can look into is dynamic blocks. You can set up several visibility states so that you insert one block and then change it. I have a general switch that can be changed to show N/O N/C & changeover. That may help you. You will have to look into these things yourself though, I know my way around 2008 but we have just got 2011 and there are probably some recent improvements. Quote Link to comment Share on other sites More sharing options...
Mica Posted February 10, 2012 Author Share Posted February 10, 2012 Thanks Dave. I want to make blocks and palettes on my computer and to use it on other. Can I define palettes in the way that I can easily transfer data, or I must repeat procedure every time when I wont to "install" it on some other computer? By your post it looks like I need to repeat procedure. Regards, Milan Quote Link to comment Share on other sites More sharing options...
SLW210 Posted February 10, 2012 Share Posted February 10, 2012 You can also make toolbar button macros, drop down menus, insert with design center or create custom palettes. Plenty of threads addressing this on CADTUtor. Quote Link to comment Share on other sites More sharing options...
Mica Posted February 13, 2012 Author Share Posted February 13, 2012 Thank you all. Of course, I have one more question, for now. When I drew my scheme I have block frame around it. Can I use data (attributes) from frame and attach them on every block inside, or when I export data to excel can I have there that data by original data from blocks? I don't need to have data from frame attached by other blocks in file.dwg, I need them in file.xlsx. Regards, Milan Quote Link to comment Share on other sites More sharing options...
Mica Posted February 20, 2012 Author Share Posted February 20, 2012 People... Anyone 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.