Jump to content

AutoCAD Customizing with AutoIT


Recommended Posts

Here is what I am looking for. So any help you guys can provide would be awesome.

In my company we uses blocks to insert into drawings to create 3d mechanical assemblies. We use a 3d Figure Library of over 2000 models and currently when we save a drawing it is usually around 40 to 80 megs in size. Because of the size we are running into file storage issues. So what I would like to do is create a utility that would create a object dictionary or some sort of small file that contains the all the block attributes and information. (block name, x , y ,z, and scale) and then purge all the blocks out of the drawing. There by reducing the file size down significantly allowing for us to archive more files. Since we do revisions very often, the utility would need to be able to reinsert the blocks into the proper locations for us to make the necessary changes. We store all of our blocks in a standardized location on our hard drives. So the application would only need to look at the AutoCAD search paths to find the blocks or do a search on the hard drive. (All of our blocks contain attribute files that contain a part number that we run through a data base to extract a bom) Currently we use multiple versions of AutoCAD so this utility would need to work with CADs 2000-2008 so the Standard arx coding for Autocad will not work.

Project flow: create drawing -> create 3d renderings and topviews -> save drawing-> depopulate drawing by removing the blocks and save the info to the dictionary file-> close drawing-> open to revise drawing-> repopulate with the blocks using the information in the dictionary-> Make changes to the drawing-> depopulate the drawing for storage.

Is this something even possible with AutoIT?..... I have done a few searches for AutoCAD customization but nothing that would help me. So if any of you guy have experiance working with AutoCAD using AutoIT. Please help me to Start this project. We currently are using a utility that does all of this for us but due to it being in an arx format we are unable to use it on the newer versions of AutoCAD.(it only works for cads 2000-2005)(I would rewrite this in arx but I do not have the source code ffor the custom program it was developed by a guy that was fired 2 years ago)

Thanks

Tim

Link to comment
Share on other sites

drawing it is usually around 40 to 80 megs in size. Because of the size we are running into file storage issues.

I think its by far cheaper to buy more disk space, than to develop such a complex software. There are now disks on the market (currently only consumer market) with 1 TByte (1000 Giga Byte), so it should be no problem to build a server with several TByte in a RAID5 configuration and another server with even more TByte a backup to disk system.

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

I think he is wanting to do away with having to import a large block just to use a few blocks and having to purge out the blocks not in use. Does this file contain all the blocks your company uses, like title ect? Why not splitting up that file into smaller files depending on categories?

www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Link to comment
Share on other sites

I think he is wanting to do away with having to import a large block just to use a few blocks and having to purge out the blocks not in use. Does this file contain all the blocks your company uses, like title ect? Why not splitting up that file into smaller files depending on categories?

Each drawing that we do is made up of a selection of blocks. the drawing may contain 10 block or it may contain up to 300 blocks. In my company we design playgrounds and each block represents one item on the playground ( one block is a slide ,another may be a climber) and all of these blocks are placed together to make the final design. the importing of the blocks are not so bad it is the problem of storage. we can do up to 8000 drawings per year not including any revisions (8000 x 40mb = 320,000mb not including two 25mb rendering images, power point presentation, and pdf files) and to top it all off because these are designs for architectual purposes we need to keep multiple years of these files. all the utility needs to do is create some sort of database with the block name and x,y,z and scale and then remove all the blocks from the drawing. that is the easy part. the hard part is having the utility use this database file to pull the proper blocks and insert them back into the drawing in the same location as they were before the storage. I can send you a .dwg file in 2d to show you what i mean.

Link to comment
Share on other sites

What about using AutoCAD's built-in Purge command? Use AutoIt to create a list of .dwg files in a directory, then for each file found, open it in AutoCAD, wait for a window with title including "AutoCAD" and text including "AutoCAD menu utilities loaded"&@CRLF&"Command:", (this indicates AutoCAD is ready for input) then Send() the command "-purge a *{enter}n{enter}" (for command-line version of "purge all") then send "_SAVE {Enter}" and "_close ". (you can't do a qsave or your file sizes won't shrink)

-YES, it's slow, but it works. Especially if the files are on a server, just let it run overnight.

-YES, there are probably MUCH better ways to do it (I know that Cad's LISP routines have the ability to loop through multiple files [see express -> save all drawings routine if you have Express Tools installed], and I think this is your best bet as AutoCAD files themselves are rather unreadable), but you just asked if it was possible :rolleyes:

Alternately, convert all your blocks to xrefs...that will result in the smallest file size possible! However, as a CAD operator myself, I shudder at this solution - changes to your blocks in the future would be changing your record drawings for past jobs.

Edit: Another thought: you could add the line "-purge a * n" (remove the quotes) to any of your *.mnl files. Since these are loaded every time you open a drawing, it would automatically purge the drawing as soon as it was opened. In this way, only unreferenced blocks inserted the last time a drawing was open would remain. Of course, any drawings you're already done with, you'd have to open and re-save now, but in the future, it would prevent you from having to do that.

Edit2: A quick google seach led me to http://www.jtbworld.com/smartpurger.htm . I'd recommend coughing up the $25 for this utility, it looks quite powerful (even lets you recreate thumbnail icons for files in batch...how I wish I had that a few years ago!), though I haven't tried it myself. Description says it supports AutoCAD 97-2008 on 2000, XP and Vista and even lets you convert the CAD files to whatever version you want and restore the original timestamp!

Edited by james3mg
"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

What about using AutoCAD's built-in Purge command? Use AutoIt to create a list of .dwg files in a directory, then for each file found, open it in AutoCAD, wait for a window with title including "AutoCAD" and text including "AutoCAD menu utilities loaded"&@CRLF&"Command:", (this indicates AutoCAD is ready for input) then Send() the command "-purge a *{enter}n{enter}" (for command-line version of "purge all") then send "_SAVE {Enter}" and "_close ". (you can't do a qsave or your file sizes won't shrink)

-YES, it's slow, but it works. Especially if the files are on a server, just let it run overnight.

-YES, there are probably MUCH better ways to do it (I know that Cad's LISP routines have the ability to loop through multiple files [see express -> save all drawings routine if you have Express Tools installed], and I think this is your best bet as AutoCAD files themselves are rather unreadable), but you just asked if it was possible :rolleyes:

Alternately, convert all your blocks to xrefs...that will result in the smallest file size possible! However, as a CAD operator myself, I shudder at this solution - changes to your blocks in the future would be changing your record drawings for past jobs.

Edit: Another thought: you could add the line "-purge a * n" (remove the quotes) to any of your *.mnl files. Since these are loaded every time you open a drawing, it would automatically purge the drawing as soon as it was opened. In this way, only unreferenced blocks inserted the last time a drawing was open would remain. Of course, any drawings you're already done with, you'd have to open and re-save now, but in the future, it would prevent you from having to do that.

Edit2: A quick google seach led me to http://www.jtbworld.com/smartpurger.htm . I'd recommend coughing up the $25 for this utility, it looks quite powerful (even lets you recreate thumbnail icons for files in batch...how I wish I had that a few years ago!), though I haven't tried it myself. Description says it supports AutoCAD 97-2008 on 2000, XP and Vista and even lets you convert the CAD files to whatever version you want and restore the original timestamp!

This isn't quite what I was looking for. We currently purge our drawing prior to closing and saving so the utility would save use little in space. We do have a utility currently that does everything I need to be done the only problem is that it was writen by a guy that was fired from my job. So i do not have the source code for it (it is property of my company but it is missing among other things). The utility was written in object arx and since the release of 2007 it no longer works with autocad because it was not written in unicode. So what I am trying to do is create a utility siminar to the existing one that will provide us with the means to save more of our drawings. All i have on the utility is a few of his proposal notes. From what I can tell the utility he created creates a dictionary object within cad that hold the xyz, scale, and block name. Then it deletes all the blocks in the drawing and then purges it thereby reducing the files size usually over 98%. When the drawing is opened up again you just click a button and the utility finds the dictionary object and and pulls the information and places all the blocks back in in the original locations. The reason for all this is that I am not an expert when it comes to programing and I am familar with autoIT but not with lisp, vb, or arx
Link to comment
Share on other sites

  • 1 year later...

This isn't quite what I was looking for. We currently purge our drawing prior to closing and saving so the utility would save use little in space. We do have a utility currently that does everything I need to be done the only problem is that it was writen by a guy that was fired from my job. So i do not have the source code for it (it is property of my company but it is missing among other things). The utility was written in object arx and since the release of 2007 it no longer works with autocad because it was not written in unicode. So what I am trying to do is create a utility siminar to the existing one that will provide us with the means to save more of our drawings. All i have on the utility is a few of his proposal notes. From what I can tell the utility he created creates a dictionary object within cad that hold the xyz, scale, and block name. Then it deletes all the blocks in the drawing and then purges it thereby reducing the files size usually over 98%. When the drawing is opened up again you just click a button and the utility finds the dictionary object and and pulls the information and places all the blocks back in in the original locations. The reason for all this is that I am not an expert when it comes to programing and I am familar with autoIT but not with lisp, vb, or arx

Im on a CAD Customization Company right now. You could just e-mail me at leipogs23@yahoo.com

Link to comment
Share on other sites

Kind of sounds more like a ghost objects problem for the files to end up that big.

Run a test. Open a dwg and select everything with a selection box and cut & paste into an empty drawing. Then go back to the supposedly empty drawing and ctrl A (Select All). Are there several thousand blue squares that show up? If they are there then purge doesn't get rid of them and there is no way to get rid of them. Only solution I found was to cut & paste into an empty drawing, leaving all of the trash behind.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...