Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

NewAlignement between wall structural layer and edge of floor

0 REPLIES 0
Reply
Message 1 of 1
maxime.touchard7RAK6
271 Views, 0 Replies

NewAlignement between wall structural layer and edge of floor

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 ?
    }
}
Labels (3)
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community