Message 1 of 10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I have a Detail Item family which is composed of lines, solid, and and an Arc as can be seen in RevitLookup snoop below:
Using this code ("detail" variable is casted from Element to FamilyInstance):
Options geomOptions = new Options();
geomOptions.DetailLevel = ViewDetailLevel.Fine;
geomOptions.IncludeNonVisibleObjects = true;
FamilyInstance familyInstance = detail as FamilyInstance;
if (familyInstance != null)
{
GeometryElement symbolGeom = familyInstance.Symbol.get_Geometry(geomOptions);
if (symbolGeom != null)
{
foreach (GeometryObject geomObj in symbolGeom)
{
if (geomObj is Solid solid)
{
Debug.WriteLine("Solid");
}
else if (geomObj is Curve curve)
{
if (curve is Line line)
{
Debug.WriteLine("Line");
}
else if (curve is Arc arc)
{
Debug.WriteLine("Arc");
}
}
}
}
}
I get the following output:
Line
Line
Line
Line
Line
Line
Line
Line
Line
Line
Line
Line
Line
Line
Solid
I tried also
GeometryElement instanceGeom = familyInstance.get_Geometry(geomOptions);
but it returns null.
What am I doing wrong?
Thank you!
Solved! Go to Solution.