Hi there !
I'm trying to create an alignement between a CompoundStructureLayer of a wall and the edge of a floor.
The two lines are already geometrycally aligned. The issue is that I can't find a way to get a Reference for the line or the plan that represent a Layer of wall.
The layers are only visible in "fine" detail level on a 2D view.
My code so far to get the wall curves :
Options opt = new Options { ComputeReferences = true, IncludeNonVisibleObjects = true, DetailLevel = ViewDetailLevel.Fine};
Solid sol = wall.get_Geometry(opt).First() as Solid;
List<EdgeCurve> wallCurves = new List<EdgeCurve>();
foreach (Edge edge in sol.Edges)
{
wallCurves.Add(new EdgeCurve(edge));
}
foreach (EdgeCurve wc in wallCurves)
{
foreach (EdgeCurve cc in floorCurves)//obteined the same way that wall curves
{
SetComparisonResult intersectResultCeiling = wc.curve.Intersect(cc.curve, out IntersectionResultArray resultArrayCeiling);
if (intersectResultCeiling == SetComparisonResult.Equal)//never goes here because wall layers curves not represented here
{
Reference ceilingRef = cc.edge.Reference;
Reference wallRef = wc.edge.Reference;
doc.Create.NewAlignment(view3d, ceilingRef, wallRef);
}
else
{
DebugUtil.log("result " + intersectResultCeiling);
}
}
}
public class EdgeCurve
{
public Edge edge;
public Curve curve;
public EdgeCurve(Edge edge)
{
this.edge = edge;
curve = edge.AsCurve();
}
}
Code to get the layers of the wall :
CompoundStructure mainStructure = (revitType as WallType).GetCompoundStructure();
foreach (CompoundStructureLayer layer in mainStructure.GetLayers())
{
if (layer.Function == MaterialFunctionAssignment.Structure)
{
//Something here to get the edge/curve/reference ?
}
}