GMSH exporter
-
Hi Dan, thank you for all the suggestion!!! Very, very usefull!! I'll made all the corrections as soon as possibile.
What about the loop? Any solution? -
I'm not sure which will be more helpful, but play around with
Face.outer_loop
andFace.loops
.https://developers.google.com/sketchup/docs/ourdoc/face
Outer look should return just the outer loop around a face. Loops should return an array of loops that bound the face, meaning if there are holes in the face, it will return the loop around those holes. It looked like gmsh didn't want faves with holes though. So you might triangulate your model first to get rid of holes in faces. Or I suppose you could just triangulate faces with holes in them?
-
Though I guess if you're using the quicker polygon mesh then the standard sketchup face loop might not help? I'm not too sure how that would all interact.
-
Ok. Now I'm working with the mesh. But the problem of the ordering, as GMSH needs, the edges of the mesh is still pending..... can you suggest how to solve?
-
Face.outer_loop.edges
returns the edges in ccw order: edges have .start and .end vertices, .length and .line [start+vector] etc...
Face.outer_loop.vertices
is similar for vertices -pt=vertex.position
gives a Point3d andapt=pt.to_a
returns an[x,y,z]
array.
If your file format needs YZ flipping adjust the array into[x,-z,y]
to solve this...
Point coordinates are in always inches [irrespective of the model's units] BUT these can be converted to other unit formats - e.g..to_m
. To make the 'number' into a string use.to_s
on it... -
If he's already got his mesh put together, would it make sense to use that object to then write all the vertices? Something like this will display them to your console for testing. the
mesh
I use in the first line is your mesh object.mesh.polygons.each_with_index do |e,index| unless e==nil puts "" puts "Face #{(index+1).to_s}" e.each_with_index do |pt, index2| puts "Vert# #{pt.to_s} - " + mesh.polygon_points_at(index+1)[index2].to_s end end end
-
Hi guys
I'm returning on this plugin. I added the license (GLP2), so it's open sourceDo you think it is a good idea to map the nodes with a Dictionary? As in IGES_EXPORT plugin http://sketchucation.com/forums/viewtopic.php?f=323&t=43307&hilit=iges?
-
Hi Bomastudio,
Some time ago I've written an export script from Sketchup to Gmsh.
Sketchup Groups are exported as Volumes in Gmsh
Sketchup Faces are exported as plane surfaces in Gmsh
Sketchup Edges are exported as lines in Gmsh
Sketchup Vertices are exported as points in GmshThe script handles nested groups and applies all transformations to the points in Gmsh
Inner faces are exported correctly.
It even exports text entered in Sketchup (not 3D text).The only thing this script doesn't do is: Export circles and arc's as Gmsh circles, it now just exports them as lines and points (that's how Sketchup see's them).
To correct this you'll need to take a look a IGES_EXPORT and how it exports circles, cylinders and cones.
-
Thanks for posting this! When opening the .geo file in gmsh, visually everything looks correct, but gmsh lists errors when reading the line loops.
-
@jsgodwin said:
Thanks for posting this! When opening the .geo file in gmsh, visually everything looks correct, but gmsh lists errors when reading the line loops.
You could give my exporter a try, the line loops are exported correctly.
-
@djskippy said:
Hi Bomastudio,
Some time ago I've written an export script from Sketchup to Gmsh.
Sketchup Groups are exported as Volumes in Gmsh
Sketchup Faces are exported as plane surfaces in Gmsh
Sketchup Edges are exported as lines in Gmsh
Sketchup Vertices are exported as points in GmshThe script handles nested groups and applies all transformations to the points in Gmsh
Inner faces are exported correctly.
It even exports text entered in Sketchup (not 3D text).The only thing this script doesn't do is: Export circles and arc's as Gmsh circles, it now just exports them as lines and points (that's how Sketchup see's them).
To correct this you'll need to take a look a IGES_EXPORT and how it exports circles, cylinders and cones.Thanks!!!!! I was looking for this plugin for a long long time!!!!
Advertisement