Message 1 of 5
Not applicable
07-25-2019
04:11 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to use the PickObjects method overload with the form...
public IList<Reference> PickObjects( ObjectType objectType, ISelectionFilter selectionFilter, string statusPrompt, IList<Reference> pPreSelected )
The last argument "pPreSelected" appears to be used for pre-selecting elements in the active view. However its not clear what kind of references are required for this method. For example I want to pre-select some walls that I obtained through a FilteredElementCollector, but there isn't exactly a GetReference() method for the Wall class. I tried getting a reference from the wall geometry from the method below but the PickObjects method did not pre-select anything.
Any ideas?
Thank you
public static Reference GetWallReference(this Wall wall)
{
var AllReferences = new List<Reference>();
var geoinst = wall.get_Geometry(NewOptions())
.FirstOrDefault() as GeometryInstance;
foreach (object item in geoinst.GetInstanceGeometry())
{
if (item is Solid)
{
foreach (PlanarFace face in (item as Solid).Faces)
{
AllReferences.Add(face.Reference);
}
foreach (Edge edge in (item as Solid).Edges)
{
AllReferences.Add(edge.Reference);
}
}
else if (item is Autodesk.Revit.DB.Line)
{
AllReferences.Add((item as Autodesk.Revit.DB.Line).Reference);
}
}
return AllReferences
.FirstOrDefault(refer =>
refer.ElementReferenceType
.Equals(ElementReferenceType.REFERENCE_TYPE_NONE) );
}
Solved! Go to Solution.