2016-04-04 49 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