2
votes

I'm trying to import a triangle mesh from file (e.g., .3ds, .dae). However, it seems that some of the faces (triangles) are being ignored. If I scale the model by 10x before importing, then the triangles are in tact. Is there a way to force sketchup to load all faces, even small ones?

Here's an example of loading a closed mesh (no boundaries) at its regular scale. SketchUp has ignored a few of the triangles, creating holes and dangling edges: a few missing triangles

If I shrink the model, the problems are much worse: many problems

But if I scale up the model enough, the problems go away: no problems

Also, immediately after I import my cursor is set to "move mode", so the object is placed wherever my cursor randomly happens to be. Is there a way to import the model exactly into the current coordinate system without mouse interaction?

1

1 Answers

0
votes

Yes, it's a known problem that Sketchup doesn't import very small edges/faces correctly. You can automate the import process of an upscaled model with this ruby script though:

model = Sketchup.active_model
# Import your dwg file, true if you want the summary screen
model.import 'C:\path\to\example.dwg', false

# Reset the selected tool
model.select_tool(nil)

# Get all imported faces
faces = model.entities.grep(Sketchup::Face)

# Create a new ComponentDefinition
definition = model.definitions.add "dwg"

# Add the points of every face to the definition  
faces.each{|f| definition.entities.add_face f.vertices}

# Remove all entities
model.entities.clear!

# Create a new DefinitionInstance that is scaled by 0.5
transformation = Geom::Transformation.new(0.5)
instance = model.entities.add_instance definition, transformation

# Explode the component to work with the model
instance.explode

This adds the component to the origin and takes care of scaling the imported model back. If your model were a skp file, you could even load it directly into a ComponentDefinition, but that doesn't work for dwg files.