I want to select an edge on cable tray. But the reference I got from the Selection.PickObject() can't get anything.
But it works on Pipe.
Reference pickObj = sel.PickObject(ObjectType.Edge);
Log.Info("side align " + AlignSide.Id + " " + AlignSide.UniqueId);
try
{
GeometryObject go = AlignSide.GetGeometryObjectFromReference(pickObj) as GeometryObject;
if ( go is null)
{
Log.Info("geometry is null");
Options options = new Options();
options.ComputeReferences = true;
options.DetailLevel = ViewDetailLevel.Fine;
GeometryElement ge = AlignSide.get_Geometry(options);
foreach (GeometryObject item in ge)
{
if (item is Solid solid)
{
foreach(Edge edg in solid.Edges)
{
Log.Info(edg.Reference.ConvertToStableRepresentation(doc));
}
}
}
}
Edge edge = go as Edge;
Log.Info( "picked reference: " + pickObj.ConvertToStableRepresentation(doc));
if (edge == null)
{
Log.Info("edge is null");
}
Element element = doc.GetElement(pickObj.ElementId);
Line sideLine;
sideLine = edge.AsCurve() as Line;
}
catch (Exception ex)
{
}
I print all the references of cable Tray. and last reference is from pickObject().
16cc5331-08cb-404f-bc36-bec6c55aac53-004c8655:4:LINEAR
16cc5331-08cb-404f-bc36-bec6c55aac53-004c8655:7:LINEAR
16cc5331-08cb-404f-bc36-bec6c55aac53-004c8655:11:LINEAR
16cc5331-08cb-404f-bc36-bec6c55aac53-004c8655:15:LINEAR
16cc5331-08cb-404f-bc36-bec6c55aac53-004c8655:16:LINEAR
16cc5331-08cb-404f-bc36-bec6c55aac53-004c8655:12:LINEAR
16cc5331-08cb-404f-bc36-bec6c55aac53-004c8655:8:LINEAR
16cc5331-08cb-404f-bc36-bec6c55aac53-004c8655:5:LINEAR
16cc5331-08cb-404f-bc36-bec6c55aac53-004c8655:18:LINEAR
16cc5331-08cb-404f-bc36-bec6c55aac53-004c8655:9:LINEAR
16cc5331-08cb-404f-bc36-bec6c55aac53-004c8655:13:LINEAR
16cc5331-08cb-404f-bc36-bec6c55aac53-004c8655:17:LINEAR
picked reference: 16cc5331-08cb-404f-bc36-bec6c55aac53-004c8655:3022:LINEAR
Is there any way to get edge of cable tray from PickObject().
My revit version is 2019.
Solved! Go to Solution.
Solved by RPTHOMAS108. Go to Solution.
If you switch to coarse detail level you can select such edges. Otherwise you can select a point on a face then find the distance of that point to each curve in order to select the edge.
Not sure why you can't get the reference in fine detail view.
Can't find what you're looking for? Ask the community or share your knowledge.