algorithmic modeling for Rhino
Hi all,
I have been struggling with this portion of script and I was on the RhinoCommon
I got this message
"Error: 'AreaMassProperties' is not a member of 'Rhino.Geometry.Surface'."
I guess I need to assign the properties but how?
Anybody have a clue?
Thanks in advance
Here is the portion of my script
-----------------------------------------------------------------------------
Private Sub RunScript(ByVal ArrSrf As List(Of Surface), ByRef A As Object)
Dim massProps As AreaMassProperties
Dim CentPt As New point3d
Dim ArrCent As New List(Of Point3d)
Dim j As Integer
For j = 0 To ArrSrf.count() - 1
ArrSrf(j).AreaMassProperties(massProps)
CentPt = massProps.Centroid
ArrCent.Add(CentPt)
Next
A = ArrCent
End Sub
-----------------------------------------------------------------------------Tags:
Instances of the AreaMassProperties are created by calling the Compute function on the AreaMassProperties class. Your code should be changed to look something like..
Private Sub RunScript(ByVal ArrSrf As List(Of Surface), ByRef A As Object)
Dim ArrCent As New List(Of Point3d)
For j as Integer = 0 To ArrSrf.count() - 1
Dim massProps As AreaMassProperties = AreaMassProperties.Compute(ArrSrf(j))
Dim CentPt As Point3d = massProps.Centroid
ArrCent.Add(CentPt)
Next
A = ArrCent
End Sub
it works, thanks
But I don't get why you need to compute instead of doing like I did?
cheers
because there is no AreaMassProperties function on a Surface instance
-Steve
http://www.grasshopper3d.com/forum/topics/geometry-array-and-sorting
Well, I should have precise a bit more my question. I don't understand the writing evolution from this topic
http://www.grasshopper3d.com/forum/topics/geometry-array-and-sorting
to the new SDK.
Even if the entities are Brep they is no more AreaMassProperties function, right?
Sorry, for stupid question but I try to understand.
Hi Min,
There needs to be a function somewhere that computes the area/mass properties of a piece of geometry. The most obvious options are:
The first option was picked for the old SDK. It makes intuitive sense to put it on the geometry itself, but the downside is that we'll have these methods sprinkled all over the SDK (one on surface, one on brep, one on mesh, one on extrusion objects etc. etc.)
For RhinoCommon we chose to put this function on the AreaMassProperties class. The benefits of this choice are that all the functions to do with area/mass computation are in a single spot, so they're easier to find. It's also easier to provide overloads for computing multiple shapes at the same time, as this function can take a collection of breps all in one go. Another benefit is that classes like Surface, Brep and Mesh remain somewhat simpler.
Personally I prefer the second option, but I'll grant you that's little more than an opinion.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by