2014-01-06 22 views
1

我有一個問題,我怎麼能在一個對象(組件)的紅寶石控制檯cooridinates(x,y,z)?我需要這個cooridnates將這個座標發送給其他對象。謝謝。在Sketchup(在紅寶石控制檯)中獲取對象(組件)的座標

+0

似乎沒有被太多Sketchup的活動在SO;您可能在其他論壇有更好的運氣,例如[SketchUcation](http://sketchucation.com/forums/viewtopic.php?t=10142)。 –

+0

也許檢查鏈接:https://groups.google.com/forum/#!topic/sketchupruby/9xCDs9qfBSo – zrl3dx

+0

這是一個令人興奮的問題,我希望在這裏看到更多。如果您發現問題,請將答案發布到您自己的問題上,並接受它。 –

回答

1

「座標」有點模棱兩可,這取決於您是否想要邊界框中的點,插入點或組件內的頂點。

但是一個簡單通用的例子是:

# Assuming user has selected a ComponentInstance: 
instance = Sketchup.active_model.selection[0] 
puts instance.transformation.origin 

ComponentInstance.transformationSketchUp 6.0+

的transformationmethod用於檢索該實例的轉型。

http://www.sketchup.com/intl/en/developer/docs/ourdoc/componentinstance.php#transformation


Transformation.originSketchUp 6.0+

原點方法檢索一個剛性變換的原點。

http://www.sketchup.com/intl/en/developer/docs/ourdoc/transformation.php#origin