[Plugin] IGES Export - 27 February 2012
-
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.
-
Great plugin. Helped me. Thank you!
My model does export with one problem. If you want the file to test with, let me know.
-
@realwarder said:
My model does export with one problem. If you want the file to test with, let me know.
You need to describe what this problem is. Otherwise it's completely impossible to know what is going on.
-
@thomthom said:
@realwarder said:
My model does export with one problem. If you want the file to test with, let me know.
You need to describe what this problem is. Otherwise it's completely impossible to know what is going on.
The first problem I was having was a section that was a long PCB cutout shaped with half-circle ends and straight sides was exported as curved sides.
I got around that by manually fixing in the destination CAD.
Current issue is a metric sized drawing is exporting to inches. Not sure how this plugin determines the units.
I.e. my PCB which is 72mm wide, after exporting to an IGS, imports as a 72" wide drawing.
Advertisement