Sketchup Ruby API中的InputPoint.face方法存在一个问题。
当我导入一个图像对象然后在此图像上绘制5边多边形时。我使用InputPoint.face获取多边形后的边数。我认为输出是5,但实际上,输出是4
如果删除图像,结果将为5。
我不明白为什么输出是这样的,我该怎么做才能得到输出5?
这是我的代码
# The onLButtonDOwn method is called when the user presses the left mouse button.
def onLButtonDown(flags, x, y, view)
@ip = view.inputpoint x,y
@f = @ip.face
aEdges = @f.edges
puts aEdges.length
end
谢谢你
答案 0 :(得分:0)
所以你在导入的Image
实体上绘制了五边形面孔?当你使用InputPoint
点击其中一个五边形时,你会得到一个有四条边的脸?
这里发生的事情可能是您在Face
实体内获得了Image
。在引擎盖下,Image
实体是一个特殊的组件实例。实际上,您可以在Image
中找到model.definitions
实体的定义。
有关SketchUp和组件,组和图像的更多详细信息,请阅读以下文章:http://www.thomthom.net/thoughts/2012/02/definitions-and-instances-in-sketchup/
InputPoint
和PickHelper
似乎可以让您在Image
实体中选择面部,而不是在它到达Image
实体时停止。
您可能希望在使用之前过滤掉结果,并且您可能希望使用PickHelper
类而不是InputPoint
。
http://www.sketchup.com/intl/en/developer/docs/ourdoc/pickhelper.php
http://www.thomthom.net/thoughts/2013/01/pickhelper-a-visual-guide/
InputPoint
更多的是获取3d点进行推理,而PickHelper
最适合用于挑选和选择实体。
您可以查看Face
的{{1}}实体及其父级,以验证它的面貌及其所属的上下文。