Sunday, March 30, 2008

I-DEAS Drafting Macros



My employer is switching over to SolidWorks. I've already gone through some training classes (more on that at a later time), and we're just about to pull the trigger on buying hardware and software. Chances are that a year from now, barring really odd circumstances, I won't have much reason to launch I-DEAS.

So, I might as well share what wealth I have now, in hopes that the remaining I-DEAS holdouts can take advantage of it.

I have a collection of macros that I find to be really cool, and pretty handy. The basic ones I've had for years, and the more complicated ones I've just developed over the last couple of months. I seem to get inspired every time I see a presentation on scripting, just so happens that my most recent one was at the SolidWorks conference.

At any rate, here you go: I-DEAS Macros (122 KB Zip)

I've included a Read Me file, along with some sample symbols and an icon panel, so it shouldn't take much more than getting the file locations set up in order to see how they work. Can't say how much work will be required to adapt them to other workflows, but I've put a lot of work into comments and tracking flow control which should help.

More or less copied from the Read Me, here is what is included. I hope you find at least some of them to be useful.

PLOTTING


print_ps.prg - This is for our Document Control person to assist with the creation of PDF files. Several printer profiles have been set up using Distiller. This program will create PostScript files for each sheet in a multisheet drawing (works with single sheet, too) and drop them into an appropriate folder where additional software will convert them to PDFs.

print_all_sheets.prg - This is for all other users, and mostly provides a handy way of printing all sheets of a multisheet drawing. It provides a prompt allowing the user to choose from the available printers or file formats, then dumps files into the user's home directory.

CREATION


Create_A_Size.prg - Creates an A-size drawing, and inserts appropriate titleblock

Create_B_Size.prg - Creates a B-size drawing, and inserts appropriate titleblock

Create_C_Size.prg - Creates a C-size drawing, and inserts appropriate titleblock

Create_D_Size.prg - Creates a D-size drawing, and inserts appropriate titleblock

MODIFICATION (CURRENT)


add_another_D_page.prg - Mostly self-explanatory. Take an existing D-size drawing and add a sheet to it, along with the corresponding titleblock. Works with single sheet drawings, and drawings that were already multisheet.

add_revision_block.prg - Imports the revision block symbol, determines where to place it, and determines some preliminary values for it.

preflight.prg - Pulls the part number metadata from the drawing file, along with some information from the titleblock, to make sure that some field information in the titleblocks is correct.

reorder_sheet.prg - Works with multisheet drawings, allowing sheets to be rearranged.

sync_tblock.prg - Extracts info from the page 1 titleblock, and then applies it to any additional sheets. Also increments the sheet counter (1 of 2, etc). This one can be run standalone, but is also run as a subroutine from several other programs.

turn_borders_on.prg - Turns all view borders on, even all sheets in a multisheet drawing

turn_borders_off.prg - Turns all view borders off, even all sheets in a multisheet drawing

MODIFICATION (LEGACY)


clean_acad.prg - Drawings imported from AutoCAD will be 2 sheets, and most of the important information will be on the 2nd sheet. This macro pulls everything onto the first sheet, and deletes the 2nd sheet. The information on sheet 1 is often ugly, but usually just a view or two needs to be deleted (this is left to the user to handle).

supersheet.prg - Before the multisheet capability appeared in I-DEAS, multisheet drawings were handled by creating a "super sheet" - a very large sheet size, and then individual sheets were sort of arrayed on the same page. This is annoying, as a significant amount of panning and zooming is required. This also causes issues with printing, and you can't simply print the overall sheet. This macro will convert a supersheet into a modern multisheet drawing. The user is prompted to pick the order of the sheets (since no one ever did it the same way twice), and the macro takes care of moving views and geometry to other sheets.

integrity_check.prg - This program will determine if the drawing is AutoCAD and/or supersheet, and prompt the user to run the appropriate programs. If added to masterdrafting.cfg, it can be run automatically anytime a drawing is brought onto the screen.

SUBROUTINES


Overview: As I added more programs, I realized that I was doing the same thing over and over again in each one. So I took the code and created separate files. This helped to establish a single, reliable way of doing things. Also, as bugs are found (or in some cases, new symbol names are found), they usually only have to be fixed in one place, rather than in each different program.

check_permission.prg - Determines the access level of the drawing. Pretty much all of the macros that want to change something about the drawing will call this first, and then exit if the user does not have sufficient permissions.

detect_acad.prg - Determines whether or not a drawing is an imported AutoCAD drawing.

find_last_rev.prg - Determines which symbol contains the latest revision information. It looks for the revision block symbol that appears lowest on the print, or if it doesn't find any, uses the sheet titleblock.

find_page1_tblock.prg - Determines the symbol ID of the titleblock on the first page. As alternate symbol names are found, they will need to be added to this program.

find_page2_tblock.prg - Determines the symbol ID of the titleblock on the current sheet (not page 1). As alternate symbol names are found, they will need to be added to this program.

get_all_attrs.prg - Takes a symbol ID and extracts all known field information from it.

get_date.prg - Gets the current date, and formats it to MM/YY

get_sheet_size.prg - Determines the sheet size of the current drawing

get_user_name.prg - Determines the name of the current user. This is completely dependant on having individual projects that each user starts in (ex: user_username). I was not able to figure out any other way of determining the user information, so if separate projects are not used, this program will not work.

insert_titleblock.prg - Imports the appropriate titleblock symbol based on sheet size, and pre-populates field information

sync_tblock.prg - can be run standalone, but most of the macros that deal with multisheet drawings will run this automatically at the end. Extracts info from the page 1 titleblock, and then applies it to any additional sheets. Also increments the sheet counter (1 of 2, 2 of 2, etc).

6 comments:

Anonymous said...

Why did your company make the Jump to Solidworks? Why did you not stay with UGS? Just me being curious I guess. Thanks

The Slick One said...

1) New VP of Operations walked in and strongly encouraged the use of SolidWorks, based largely on his past experience with it. He never asked what our capabilities were in I-DEAS, mostly just looked at the large dollar figure we're paying annually for maintenance.

2) New Director of Engineering, put in place by the VP, wanted us to get our CAD system modernized. He didn't really care where we went, he was mostly concerned with getting us onto something that would make it easier for us to hire quality people.

3) Early in our evaluation, we asked our VAR, who happens to sell NX, SolidEdge, Inventor, and Catia (they helped set up our I-DEAS installation, so were familiar with our needs) to make a recommendation. Their first choice was Inventor. After some initial presentations, we decided that SolidWorks had a more complete product offering. And keeping in mind #1, it was going to take a lot more effort to try to justify anything other than SolidWorks.

I'd like to say that we went through a rigorous benchmark, but the reality is that didn't happen. That said, what I have seen in SolidWorks is very impressive. Aside from minor quibbles, I have not seen anything that makes me, as a skilled I-DEAS user, say "Oh come on, are they SERIOUS?" This differs greatly from my reaction to every "What's New In NX" presentation I've seen.

Anonymous said...

Cool thanks for the feedback
We still use I-Deas but we do have access to inventor and solidworks. We use these more as a translating tool. We also like the thick thin check tool and the draft check tool in solidoworks. Also we utilize saving an assembly with exterior surfaces only to export out to our customers. This is a nice tool that solidworks also has. To do the above we export a parasolid out of I-Deas and import it into solidworks.

Anonymous said...

I found this site using [url=http://google.com]google.com[/url] And i want to thank you for your work. You have done really very good site. Great work, great site! Thank you!

Sorry for offtopic

Anonymous said...

hi,

Any ideas how to convert I-DEAS .smd file into a dxf or other file that can be read with solidwork or solid edge?

Thank you

Brian Slick said...

Not really sure how you came across one of those. As far as I can tell, it's an internal database metadata scratch file. There is pretty much zero chance you'll find a translator for it, and it's not too likely I-DEAS would be able to do anything with it either. It's not a standalone file.