2016-04-04 48 views
2

我正在尝试从文件(例如.3ds,.dae)中导入三角形网格。但是,似乎有些面(三角形)被忽略。如果我在导入之前将模型缩放10倍,那么三角形就完成了。有没有办法强制sketchup加载所有的面孔,即使是小面孔?如何将三角形网格导入带有小面的SketchUp?

下面是以常规尺寸加载封闭网格(无边界)的示例。 SketchUp中忽略了几个三角形,创造洞和悬垂边: a few missing triangles

如果我收缩模型,问题变得更糟: many problems

但如果我规模 up模型够了,问题就消失了: no problems

此外,我在导入后立即将光标设置为“移动模式”,因此将该对象放置在我的光标随机发生的任何位置。有没有办法将模型完全导入当前坐标系而无需鼠标交互?

回答

0

是的,这是一个已知的问题,Sketchup不能正确导入非常小的边/面。您可以使用此Ruby脚本自动化虽然在升级模型的导入过程:

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 

这增加了该组件的来源和需要缩放导入模型回来照顾。如果您的型号为skp文件,您甚至可以直接将其加载到ComponentDefinition,但这对于dwg文件不起作用。

+0

似乎'model.select_tool(nil)'取消了导入命令。我在Mac OS X上用Sketchup版本16.1.1451 –

+0

似乎与http://forums.sketchup.com/t/ruby-api-model-importtopoint/18747 –

+0

嗯,太糟糕了,在我的Windows机器上工作。如果你跳过这一行会发生什么? – Sven