PDA

View Full Version : Manipulate AutoCAD files from Excel



Meatball
03-26-2010, 08:12 AM
I have a little bit of experience working with macros in Excel. I am getting into work with AutoCAD LT 2010. I have just started so please bear with my lack of proper terminology or operating procedures. Right now I am just wondering if this is possible and if my line of thinking is along a good path or not.
I deal with making cutouts in foam that match the profiles of tools. Some tools can be turned and profiled different ways and the foam can also be cut to fit tight or loose to the tool so I can have a few profiles for each tool. I have a folder containing dwg's of tool profiles. Presently each file contains only 1 profile (object?) with text giving the tool number but I would like to have each file contain all profile views of each tool with text to go with each view. I think that the way to accomplish what I want with a macro is to have each profile on a different layer or maybe each profile should be at a specific x-y location. All files would have the same number of layers and all would be named the same or the x-y locations would be matched on all files. I think the layer system would be best but do not know enough yet to be sure. If I set up all files this way I am wondering if it is possible to
1. create a list in Excel
2. have the macro open the dwg's one at a time matching each tool number on the Excel sheet ( not all tools on the spreadsheet would have a matching file)
3 copy the profile from the proper layer, layer being determined by a value in a specific cell of the spreadsheet
4. paste all of the copied profiles onto 1 new CAD file, all on the same layer, moving each paste location a distance of say 6" to the right of the previous paste

Tommy
03-26-2010, 10:32 AM
Hi Meatball,

The only way to manipulate autocad light is with script files. You cannot use macros in Autocad LT.

Now with that being said, what you are asking can be done. What I would recomend is to write block (make a block out of the "copied" profile) (wblock is the actual command) insert into the new drawing and continue.

Can you post an example excel file and maybe a couple of samples of your drawings? I could work with those to give you a working copy that you could modify if necessary.

Meatball
03-26-2010, 02:23 PM
Tommy,
Thank you for looking at this for me. The attachment to this post is sort of what I would use to to pull the images. The files I would be looking for are in col C.
See next post

Meatball
03-26-2010, 02:27 PM
This is what my spreadsheet looks like that tells me if we have the tools in our "library". Ooops, atachments not working.

Part NumberImages in LibraryExacta CreatedGould CreatedFriction FitFF Cut ReadyLoose FitLF Cut ReadyJ882031YES YESYESJ88203B1YES YESYESJ882041YES YESYESJ882061YES YESYESJ882081YES YESYESJ882131YES YESYESJ882141YES YESYESJ882151YES YESYES

Meatball
03-26-2010, 02:28 PM
Pasting copy does not work either. Let me try this

Part NumberImages in LibraryExacta CreatedGould CreatedFriction FitFF Cut ReadyLoose FitLF Cut ReadyJ882031YES YESYESJ88203B1YES YESYESJ882041YES YESYESJ882061YES YESYESJ882081YES YESYESJ882131YES YESYESJ882141YES YESYESJ882151YES YESYES

Meatball
03-26-2010, 02:45 PM
Any way the library spreadsheet has a list of tools in column A. The spreadsheet is used to tell me how many of the tools in the KIT are in the library and gives me other info. Right now I cannot get AC to publish pdf file and cannot attach any other pdf that might show what I am doing. I can say that what I would have on each layer would be a single line, connected all the way around, that follows the basic outline of a tool, sometimes a simple as a circle or rectangle but usually more complicated, think of the chalk outline around a dead body.
Again, thanks for any help

Tommy
03-27-2010, 05:23 AM
You can rename the .dwg files to .txt than I could rename them back to .dwg. I really need the dwg file, I would be working completely blind otherwise.

I am unclear with the "YESYESJ882131YES" I see the part # what is the YES?

mdmackillop
03-28-2010, 03:34 AM
Meatball,
You can attach a screenshot image as a jpg.

Meatball
03-29-2010, 08:40 AM
This is a sample of the file that tells me if tool images have been made. Columns F,J,H, & L would be what I would match the layers of the CAD drawing to. I do not have any CAD drawings set up with layers yet. As I said just starting this.

Meatball
03-29-2010, 08:57 AM
Screen shot of one tool in the "KIT"

Tommy
03-29-2010, 10:46 AM
I would suggest the something is placed in the non YES fields so it doesn't mess up any logic. this way you can actually look at the the string and tell what "views" are available for that tool.

Starting a copy of acad and running a script is doable. Inserting the drawings into another drawing on a certain layer is doable. Reading all of this from excel is doable.the only issue right now or until I do a little research is offsetting the inserts by 6" or so. This is the only thing right now that I am concerned about. One option would be to insert all the drawings at the same locations but on a different layer.

Meatball
03-29-2010, 11:22 AM
Thank you Tommy. I Think pasting to different layers would be a bit much to handle. Layer count could end up at 70, or maybe even 100 or more. Some kits get a lot of tools packed into them. Maybe another step of some sort other than 6" offsets could get closer to the end product I have in mind.
Do you think I should mark this thread solved and start a new one when I am closer to ready to actually implementing it, or should I leave it open?

Tommy
03-29-2010, 12:09 PM
It doesn't matter to me :) we could use this to kick it around until we get something to work. Starting new threads for specific questions and brainstorm in this one.

See that is why I haven't started to code yet, 100 or more layers gets way out of hand. the most I have used is 30.

Meatball
03-29-2010, 12:42 PM
OK, I will leave it open. Besides the 6" offset, the only other issue that I may have mis-represented would be that I would like to be able to work with "sets". Socket sets, wrench sets, etc. Would it make a difference if there is more than 1 tool picture on each layer or would we be able to just copy the whole layer?

Tommy
03-29-2010, 12:51 PM
It may be all or nothing, I am not sure if we can select with filters. In AutoCad full, you can. Since you cannot use vba or lsp in acad lt we may not be able to.

I started to say just put the size in excel but if you did that you might as well go ahead and fix it by hand!

Once I saw the bit holder I had figured that would come up and I don't see a problem with the sets, but once again I need to see a dwg file to make sure.

What version are you using? It looks like 2009.

BTW you plot to a pdf. or you can publish it and then print to a pdf.

Meatball
03-29-2010, 01:26 PM
Using 2010 LT. When you say you need to "see" a drawing do just mean a picture of some sort or do you need to have a copy of a dwg file? I can't seem to plot but I can make a pdf. Just not sure how either would help you.

Tommy
03-29-2010, 02:31 PM
Well it would tell me if I need to turn osnap off so I don't get unexpected results, if there are other items in the drawings, if all entities start at a certain distance from 0,0.....

I am running 2007, 2000i and 2008. Different PC's.

I once helped a guy work on a project (bill of material program for structural steel detailing) , when I got through with my part, it was working wonderfullly. He got it and it would not work to save my life or his. Once I get a copy of his drawings I found out he drew all over the place. His working drawing, at the upper right hand corner was x=-4000 y=-6000. I did not account for working in a double negative axis, I didn't account for working in the negative axis at ALL. I draw with 0,0 at the lower left hand corner. Always. I follow the KISS theroy at all times. :devil2: OK I try, to but it doesn't always work, sometimes I get short sighted and narrow minded.:rotlaugh:

Meatball
03-30-2010, 06:20 AM
I understand now. Like I said, new to AutoCAD so some explaining will be needed on occasion. Since this program has just been started I am still trying to set it up the best way I can think of at the moment but I do not know enough to be sure that it is the best way possible. I also do not have what I consider a finished example of any 1 tool yet. So to the points of your last post, I do not expect to have a y=0,x=0 starting point all the time, if working by layer I would want everything on the layer copied which may be multiple images. When I get ready to to pursue this further perhaps we can use e-mail to exchange the dwg files.
Thanks for at least letting me know that it is possible to do this. It will be a BIG time saver when it is put in place.

Tommy
03-31-2010, 05:08 AM
Just another thing to keep in mind is the naming convention of the drawing files. Make it easy on yourself and let the name tell you what it is. ex portable-hand-held-hammer-sideprofile.dwg portable-pnewmatic-tank-mounted-hammer-frontprofile.dwg

something else that will help is to set the base insertion point (command= base) to the same location each time, this way it will work the same for each drawing when we start the inserting process.

I'm sorry I didn'tpost yesterday, it was crunch time on my schedule.

bradely
07-11-2013, 12:11 AM
Well this very informative information that you shared with the members to how to manipulate or convert the auto cad file to the excel format. In this method we must can get the nice solutions of it. I do not think that it will make any kind of problem while converted.