| McNeel Wiki | |||||
| edit · print · help · all topics | |||||
Main Pages
Languages
| QuestionIs there a tool or a script that will let me select all planar meshes? AnswerCurrently, RhinoScript does not have a method that returns whether or not a mesh is planar. But, if you obtain a meshes vertices, you can test to see if all of the points are coplanar. ExampleThe following example RhinoScript demonstrates how to select all planar mesh objects.
Sub SelPlanarMeshes
Const rhMesh = 32
Dim arrMeshes, arrVertices, i
arrMeshes = Rhino.ObjectsByType(rhMesh)
If IsArray(arrMeshes) Then
Rhino.EnableRedraw vbFalse
For i = 0 To UBound(arrMeshes)
arrVertices = Rhino.MeshVertices(arrMeshes(i))
If Rhino.PointsAreCoplanar(arrVertices) Then
Rhino.SelectObject arrMeshes(i)
End If
Next
Rhino.EnableRedraw vbTrue
End If
End Sub
Here is a Rhino tooolbar button macro version of the above. _NoEcho _-RunScript ( arrMeshes = Rhino.ObjectsByType(32) If IsArray(arrMeshes) Then Rhino.EnableRedraw vbFalse For i = 0 To UBound(arrMeshes) arrVertices = Rhino.MeshVertices(arrMeshes(i)) If Rhino.PointsAreCoplanar(arrVertices) Then Rhino.SelectObject arrMeshes(i) End If Next Rhino.EnableRedraw vbTrue End If arrMeshes = vbNull arrVertices = vbNull ) | ||||
| rename · changes · history · subscriptions · lost and found · references · file upload | |||||