Message 1 of 5
Surface area of Face is wrong.
Not applicable
08-08-2013
06:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have written this fuzzy testcode, trying to extract the geometry of the glass in an Windowelement.
The dimensions of the Glass are 1170 x 1180, so the area i am looking for is around 1 m2. I get 12 m2. When i look at the family the dimensions are identical. Its in the basis sample project. I don't get it, can someone please enlighten me?
Second question. Why isn't there just a collection extracted from the object model containing all the solids in the model, with their material and geometry? Everybody who want's to do some analysis on the building needs that info. From what i'm reading i have to transform nested familyinstances???
public void Testing()
{
Document doc = Document;
String str = "";
Options opts = Application.Application.Create.NewGeometryOptions();
IList<Element> elems = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Windows).ToElements();
foreach (Element e in elems)
{
if (e.Name =="1180 x 1170mm")
{
str += e.Name + "\n";
GeometryElement geoElement = e.get_Geometry(opts);
// Get geometry object van het element.
foreach (GeometryObject geoObject in geoElement)
{
// Get the geometry instance which contains the geometry information
GeometryInstance instance = geoObject as GeometryInstance;
if (null != instance)
{
GeometryElement i = instance.GetInstanceGeometry();
foreach (GeometryObject o in i)
{
Solid s = o as Solid;
if (null != s && 0 < s.Edges.Size)
{
foreach(Face f in s.Faces)
{
Element m = doc.GetElement(f.MaterialElementId) as Element;
if (null != m)
{
if (m.Name == "Glass")
{
str += f.Area + "\n";
}
}
}
}
}
}
}
}
}
TaskDialog.Show("test",str);
}