在 Sketchup 中创建面和边对象的最快方法
我必须在 Google Sketchup 中渲染几千个多边形的网格。我发现随着模型中面数的增加,add_face
往往会变得更慢。我相信这是由于 Sketchup 在幕后运行的一些边缘检测算法造成的。希望应该有某种方法来抑制 Sketchup 正在进行的边缘检测或其他处理,直到所有面都添加到模型中。
我发现 add_faces_from_mesh
和 fill_from_mesh
速度更快,但最终得到的网格由 Surface
实例而不是 Face
组成我正在寻找的 code> 和 Edge 对象。
那么,在 Sketchup 中生成由 Face
和 Edge
对象组成的模型的最快方法是什么?有没有办法从 Surface
对象生成 Edge
和 Face
对象?
更新:我刚刚在此处读到使用 Model::start_transaction
和 Model::commit_transaction
可以用来加快速度,但我发现改进并不是很显着。我还能做些什么吗?
I have to render a mesh of a few thousand polygons in Google Sketchup. I find that add_face
tends to get slower as the number of faces in the model increases. I believe this to be due to some edge detection algorithm that Sketchup is running behind the scenes. Hopefully, there should be some way to suppress this edge detection or other processing that Sketchup is doing till all faces have been added to the model.
I found add_faces_from_mesh
and fill_from_mesh
to be much faster but I end up with a mesh consisting of Surface
instances instead of the Face
and Edge
objects I am looking for.
So, what is the fastest way to generate a model consisting of Face
and Edge
objects in Sketchup? Is there a way to generate Edge
and Face
objects from a Surface
object?
Update: I just read here that using Model::start_transaction
and Model::commit_transaction
can be used to speed things up but I found that the improvements are not very significant. Anything else I can do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
调用
add_faces_from_mesh
或fill_from_mesh
并将smooth_flags
参数显式设置为零,可以正确构造Face
和Edge对象。 Sketchup 文档声称
smooth_flags
默认为零...我的试验表明不然。Calling
add_faces_from_mesh
orfill_from_mesh
with thesmooth_flags
parameter explicitly set to zero correctly constructsFace
andEdge
objects. Sketchup Documentation claims thatsmooth_flags
defaults to zero... my trials show otherwise.只是为了澄清 -
add_faces_from_mesh
和fill_from_mesh
确实添加了边和面 - 但是,默认行为是创建具有柔软平滑边缘的网格。当您有一组通过软边连接的面时,它们将被 SketchUp 视为表面,并且当您选择它们时,实体信息窗口将显示“表面”。然而 - 在内部它仍然只是一组边和面 - SketchUp 没有 Surface 实体。
至于
Model::start_transaction
- 您必须为第二个disable_ui
参数指定 true 才能看到任何速度增益。但正如您所注意到的,SU 添加实体的速度非常慢 - 添加的实体集合越多,它的速度就越慢。添加实体的绝对最快方法是fill_from_mesh
。Just to clarify -
add_faces_from_mesh
andfill_from_mesh
do add Edges and Faces - however, the default behaviour is to create a mesh with soft and smooth edges. When you have a set of Faces connected by Soft edges they will be treated as a surface by SketchUp and Entity Info window will say "Surface" when you select them.However - internally it's still just a set of edges and faces - SketchUp has no Surface entity.
As for
Model::start_transaction
- you must specify true for the seconddisable_ui
argument in order to see any speed gains. But as you have noticed, SU is very slow to add entities - the more there is in the entities collection you add to the slower it gets. The absolute fastest way to add entities isfill_from_mesh
.