Add option to discard materials on import for performance
thomthom opened this issue · 6 comments
See #110. The import of this file might be much quicker if we use Entities.fill_from_mesh
, but that would mean you cannot apply materials per face. But this could be an option, something to prompt for when a large model is imported.
Hi Thomas,
In some special case there is a workaround.
It depends on the kind of a mesh you are importing. When using
fill_from_mesh it adds all polygons in the mesh as individual faces. Doing
this to an empty Group , the ORDER of the added polygons remains preserved
in the order of the new faces. So by keeping track of this order when
adding polygons to the mesh, it is possible to act on the corresponding
imported faces later on. So, the n-th face in the Group matches the n-th
polygon of the mesh.
We use this methode, fill_from_mesh to add a bunch of faces from one mesh
with several polygons and then change the materials and align normals of
the corresponding faces later.
Jeroen
Verstuurd vanaf mijn iPad
Op 13-feb.-2014 om 01:42 heeft Thomas Thomassen notifications@github.com
het volgende geschreven:
See #110 #110. The import
of this file might be much quicker if we use Entities.fill_from_mesh, but
that would mean you cannot apply materials per face. But this could be an
option, something to prompt for when a large model is imported.
Reply to this email directly or view it on
GitHubhttps://github.com//issues/111
.
We do use fill_from_mesh()
.
https://github.com/SketchUp/sketchup-stl/blob/master/src/sketchup-stl/importer.rb#L244
@jeroentheuns - that is interesting. I'll have to play with that.
@jimfoltz - oh!... Then I really need to look into where all that time is being spent. Maybe it's the repair function...
@jeroentheuns - have you done tests on the order of the edges/edge_uses compared to the order of the points in the polygons?
Thomas,
No, that wasn't even nececary.
Much easier: add n polygons to a mesh from a prepared array of polygons > add_fill_from mesh to a new group > grep faces from the group and collect into another array. > Both arrays now have exact matching indexes for the respective polygons and faces.
No extra checking whatsoever needed. It sound kind of risky, but, touch wood, until now it seems to hold.
Jeroen
Op 16-feb.-2014, om 19:51 heeft Thomas Thomassen notifications@github.com het volgende geschreven:
@jeroentheuns - have you done tests on the order of the edges/edge_uses compared to the order of the points in the polygons?
—
Reply to this email directly or view it on GitHub.
Closing this one as it's the healing methods that's slow.