- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want to obtain the GeometryObject to acquire the outline of a series of beams. After the FamilyInstanceFilter, there are few elements pass the filter, I think its the problem of instruct get_Geometry(opt). How to fix that problem which was not appear when I did the same to columns?
Another question is will the overlap parts of the beams' outline be removed automatically?
See the codes:
FamilySymbol beam = doc.GetElement(new ElementId(153240)) as FamilySymbol;
FamilyInstanceFilter familyInstanceFilter = new FamilyInstanceFilter(doc, beam.Id);
FilteredElementCollector filteredElements = new FilteredElementCollector(doc);
filteredElements = filteredElements.WherePasses(familyInstanceFilter);
foreach (FamilyInstance element in filteredElements)
{
if (element != null)
{
TaskDialog.Show("Found", "sa");
Options opt = application.Create.NewGeometryOptions();
opt.ComputeReferences = true;
opt.DetailLevel = ViewDetailLevel.Medium;
//opt.View = doc.ActiveView;
GeometryElement e = element.get_Geometry(opt);
foreach (GeometryObject geoObj in e)
{
//doc.Regenerate();
//TaskDialog.Show("Found", "sa");
GeometryInstance geoInstance = geoObj as GeometryInstance;
GeometryElement geoElement = geoInstance.GetInstanceGeometry();
Transform insTransform = geoInstance.Transform;
foreach (GeometryObject geoObj2 in geoElement)
{
Solid solid2 = geoObj2 as Solid;
if (solid2.Faces.Size > 0)
{
foreach (Edge edge in solid2.Edges)
{
Curve curve = edge.AsCurve();
TaskDialog.Show("revit", edge.AsCurve().GetType().ToString());
}
}
}
}
}
}
Solved! Go to Solution.