Calculate Area File3DM


#1

I´m programming a project with C# and rhinho.

I have a model 3dm

File3dm model = File3dm.Read(pathModel);

How I can calculate the area of this model?


(Willem Derks) #2

Hi Slava,

I think you need to be more specific:
What type of area are you looking for?
Do you want the area of all the surfaces in the file?
Do you want the boundingbox of the geometry in the file?
The more specific you are the more likely someone can help you along.

-Willem


#3

I have a 3dm file with one object and this object is a Mess. In this case the object is a rectangle. I want to know the Area of the surface of this object.

In my code, I use this to calculate the area of a curve:

Curve curva;

Rhino.Geometry.AreaMassProperties area = Rhino.Geometry.AreaMassProperties.Compute(curva);

and I use the curve to make other operations.

It is possible to convert file 3dm in a curve? Because I can use it to calculate the area and to make other things.


(Menno Deij - van Rijswijk) #4

Ok, just to be sure: you have a 3dm file that contains 1 curve. Then to get that curve to calculate the area, use this:

File3dm f = File3dm.Read(pathModel);
if (f.Objects.Count != 1) // check to see if there is 1 object
   return false;

File3dmObject obj = f.Objects[0]; // there is only one object

Curve crv = obj.Geometry as Curve; // try to interpret the geometry as a Curve object
if (null == crv);
    return false;

// use curve to calculate area
AreaMassProperties area = AreaMassProperties.Compute(crv);


#5

In my case I need to convert in a Mesh because my object in 3dm file is a mesh but it´s that I was looking for.

Thanks!