Hi all,
I want to write Python to automatically select a mesh and print the area of mesh.
I try to use rs.command (" Selall"), but I cannot print the mesh area successfully.
Is there any suggestion to edit the python or grasshopper ?
Thanks
Hi all,
I want to write Python to automatically select a mesh and print the area of mesh.
I try to use rs.command (" Selall"), but I cannot print the mesh area successfully.
Is there any suggestion to edit the python or grasshopper ?
Thanks
Try the example code here:
https://developer.rhino3d.com/api/RhinoScriptSyntax/#mesh-MeshArea
Do you only have one mesh that you want automatically selected?
Hi AndersDeleuran,
Thanks for your reply. I had follow this script.
Unfortunately, I want the need to be selected automatically. No manual selection required.
Hi Helvetosaur,
Please see my script as below shown.
I want to scale so that the areas of the two mesh are the same and automatically select the grid by mesh color or different layers.
import rhinoscriptsyntax as rs
a = rs.GetObject(“Select ORG mesh”, rs.filter.mesh)
rs.Command(“Selall”)## mesh can not be selected automatically
area_a = rs.MeshArea(a)
print “Mesh area:”, area_a[1]
b = rs.GetObject(“Select flat mesh”, rs.filter.mesh)
rs.Command(“Selall”)## mesh can not be selected automatically
area_b = rs.MeshArea(b)
print “Mesh area:”, area_b[1]
print ST
rs.ScaleObject( b, origin, (ST,ST,1), True )
Hi Helvetosaur,
Please see my script as below shown.
I want to scale so that the areas of the two mesh are the same and automatically select the grid by mesh color or different layers.
import rhinoscriptsyntax as rs
a = rs.GetObject(“Select ORG mesh”, rs.filter.mesh)
rs.Command(“Selall”)## mesh can not be selected automatically
area_a = rs.MeshArea(a)
print “Mesh area:”, area_a[1]
b = rs.GetObject(“Select flat mesh”, rs.filter.mesh)
rs.Command(“Selall”)## mesh can not be selected automatically
area_b = rs.MeshArea(b)
print “Mesh area:”, area_b[1]
origin = (0,0,0)
ST = area_a[1]**0.5/area_b[1]**0.5
print ST
rs.ScaleObject( b, origin, (ST,ST,1), True )
You can probably use ObjectsByType
with the mesh type filer (i.e. 32
).
Hi AndersDeleuran,
Thank you for your help. I solved the question