[Plugin] IGES Export - 27 February 2012
-
When sketchup is used to do mechanical CAD it is sometimes desirable to convert the models to a CAD format.
There are two standard exchange formats, step and iges, that are widely used. I have chosen iges as the format is much more manageable, though it is the older standard. There are tools available to convert from iges to step if required (I use the free HeeksCAD)The plugin first does some checking if the model contains valid solid geometry. Only closed shells are recognized as solid geometry and exported. The parts are not allowed to have inner surfaces or dangling lines. Geometry that does not conform is deleted prior to export, a warning message is given.
The model is segmented into solid shapes and then these are exported into an iges file. All the changes to the model are undone afterwards.
Sketchup represents all geometry as faces and edges, curved geometry is smoothed for viewing, but internally it is still edgy. Iges however expects the shapes to be defined in their actual shape. Thus a solid in iges is usually represented as a collection of analytical shapes and spline surfaces.
There is no universal way to create this shapes from the sketchup faceted mesh. My exporter recognizes cylindrical and conical shapes and exports these as true cylindrical surfaces. All other geometry is exported as edgy facets.
This is the curved geometry that most often is present in mecanical parts.
Probably I will attempt to do some spline fitting in the future.Install the exporter by copying the file into the plugins directory. There will be a new function added to the tools menu.
Update:
V 0.5 Undo-Bug corrected. The exporter manipulates the model, but now undoes the changes afterwards correctly.
V 0.6 deletes temp file. Removes inner faces instead of deleting the whole object. Clean exit if no filename or nothing to export
V 0.7 Delete edges that connect to inner surfaces before export
-
This is a greatly needed plugin.
I tested the plugin on SketchUp 8.0.3117 and tried importing the IGES file into Alibre.
A .igs.tmp file was left behind, and Alibre spit out the error: ACISERROR_FILE_OF_UNSUPPORTED_UNIT.
I overrode the units in the Alibre import settings and got the error: ACICERROR_IMPORT_NO_FACES.
No combination of settings in the Alibre importer let me import the IGES file.The file did import perfectly into ProE and a crappy IGES viewer program I found online, so I am not sure what is up with Alibre.
The curves came out perfectly, even a six sided cylindrical worked correctly when smoothed (circle) and un-smoothed (hex).
-
If you have problems it may be an option to convert the iges to step with an apropriate program. I have done this for Autodesc Inventor that will not import the iges into solids but wireframes. Converted to step it works fine.
It is also a good idea to export one part at a time and not too many together. You then see what part causes the problems and I have the impression that complex collection of parts tend to be more difficult. -
Hi and welcome to the forum.
I had a quick scan through your plugin - got a couple of comments:
.typename
: Avoid at all cost! It's very slow to use! It has always bugged me that the API doc use it for its examples.I see you use attributes a lot - but they are all removed at the beginning of an export. Is that to keep track of entity information while you process the model? If so I'd suggest you use a Hash to keep track of entity data - instead of adding prosessing data to the model which will increase file size. In addition, attributes are slow - lots of string manipulation and lookups.
I generally recommend people not to extend the base classes - due to the possibilities of conflict.
-
You should mention that the exporter might erase stuff.
And that it makes all groups and components unique!
It is not expected behavior that an exporter modifies the model it exports.
-
Exported data/files are not subject to an undo or an abort call...
IF your exporter must change the model's data so it can work successfully, then the correct way to proceed is to satrt ALL of its actions after aSketchup.active_model.start_operation('IGESexport')
and after it's made the export use a closingSketchup.active_model.abort_operation
, which undoes ALL of the changes you have made to the model BUT leaves the external file[s] alone...
That way you get your data exported correctly but the user gets no nasty surprises when he finds his model has be tampered with !
-
Of course the exporter should not modify the model. It does it during work but afterwards undoes the changes. In V0.4 the undo was made a comment for testing, in V0.5 this is corrected.
TIG: is there a difference whether I use "model.abort_operation" or "model.commit_operation" and "Sketchup.undo" as I do?
thomthom: the exporter never was optimized for fast operation, I wanted to keep it simple. As I undo the changes it is no problem to adhere attributes to the entities, they never will be saved. IGES is constantly referring with pointers to its structural elements, keeping track with attributes was simpler to implement and more descriptive. I agree that hashes might be faster. But as the structure is still growing when I am going to implement splines I still prefer the more understandable approach.
What do you recommend to use instead of "typename"? -
@rainer.ochs said:
What do you recommend to use instead of "typename"?
Use
.is_a?( Sketchup::Face )
etc... -
I have some files in iges format I would like to import in SU, so an importer would also be nice to have...
-
One interesting part in this is that it creates "real" solid geometry out of SU "solids". Could it be expanded into the DXF format too? That would add a useful feature that the current DWG/DXF exporters lack.
Anssi
-
@anssi said:
Could it be expanded into the DXF format too?
I got good results with HeeksCAD ( http://heeks.net) a freeware CAD program.
It can import iges and once in Heeks you can save it to step, dxf and stl.
The programs file converting is based on open cascade (http://www.opencascade.org) a very sophisticated system. As far as I have been testing, the results are reliable. -
@zacchia said:
I have some files in iges format I would like to import in SU, so an importer would also be nice to have...
There is a description on http://eagleup.wordpress.com/?s=iges&searchbutton=go%21
on Importing a STEP or IGES file into Sketchup using FreeCAD and MeshLab.
file.step => FreeCAD => file.stl => MeshLab => file.dae => Sketchup => file.skp -
@rainer.ochs said:
There is a description on http://eagleup.wordpress.com/?s=iges&searchbutton=go%21
on Importing a STEP or IGES file into Sketchup using FreeCAD and MeshLab.
file.step => FreeCAD => file.stl => MeshLab => file.dae => Sketchup => file.skpThank you for this information, it works! I already knew meshlab, freecad not...
-
I tried to open .igs export from SU in Rhino. It bring geometry but geometry is broken. The model is made of separate surfs and some surfs (curved) are missing.
-
Nice addition!
I am struggling to find the size limit that will work.
I have a very complex model the size of an aircraft that seems to lockup everytime.I test this with a small box and it works great.
Suggestions???
-
This plugin is amazing. The possibility to export "solids" out of SU is for me close to the holy grale Thank you so much..
-
@davidvt said:
I am struggling to find the size limit that will work.
I have a very complex model the size of an aircraft that seems to lockup everytime.@sepo said:
I tried to open .igs export from SU in Rhino. It bring geometry but geometry is broken.
I do not think, that the size itself is a problem. I usually scale my models in micron so I also have fairly big numbers and this worked fine. I think the problem is more the complexity. To convert from a face-model to solid it is very important that the outer shell has no gaps and no inner geometry. The exporter removes all parts it cannot convert to real shells.
Suggestion 1: Try redo to see what the exporter does to the model. If the parts are deleted there it is a problem with the geometry.
Suggestion 2: Try HeeksCAD to open the iges. If it is ok there, convert to step and import from there. If it is not ok the iges is the problem. Feel free to send me your model to the email that is given in the code.
-
I haven't tried the plugin yet, but it is very exciting. This could make sketchup much more useful for me. Where I work the mechanical engineers use Catia, and it would be awseome to be able to send them my drawings in a format that they can use.
I also want to second the FreeCad & MeshLabs method as a great way to get IGES files into sketchup. -
@gordon_smith said:
I also want to second the FreeCad & MeshLabs method as a great way to get IGES files into sketchup.
There is also a direct importer plug-in for stl into sketchup:
http://sketchuptips.blogspot.com/2010/03/sketchup-stl-importer-redo.htmlA direct export to stl can be found at http://www.guitar-list.com/download-software/convert-sketchup-skp-files-dxf-or-stl
STL from other formats can be converted with FreeCAD or the above mentioned HeeksCAD.
All of these tools do not segment the model into different objects and the exporter does not generate a solid.
The importer generates a lot of nasty inner edges, but with a small tweeking of the script this can be fixed.
Just add the following lines into main after the import:
a = Array.new Sketchup.active_model.entities.each{|e| if (not e.deleted?) && (not e.hidden?) if e.is_a? Sketchup;;Edge if e.faces.size == 2 if e.faces[0].normal == e.faces[1].normal a << e end end end end Sketchup.active_model.entities.erase_entities(a) }
-
This has helped me a LOT! Thank you very much.
Advertisement