How to know which curve is span direction in floor sketch?

How to know which curve is span direction in floor sketch?

qoreodlf37
Enthusiast Enthusiast
613 Views
5 Replies
Message 1 of 6

How to know which curve is span direction in floor sketch?

qoreodlf37
Enthusiast
Enthusiast

Hi, I have a floor like this. And I get all curves of floor  sketch.

qoreodlf37_0-1719899879030.png

List<Curve> floorCurves = new List<Curve>();
foreach (CurveArray arr in floorSketch.Profile)
{
    foreach (Curve curve in arr)
    {
        floorCurves.Add(curve);
    }
}

 

I want to know which curve is span direction.

 

I'm trying to edit floor's sketch with SketchEditScope.

When I delete span direction curve and commit sketchEditScope, Revit say 'structural floor span direction not specified'.

I know I can change floor's structural to false.

But if I change floor's structural to false, Revit say 'Path Reinforcement can be placed only in Structural Floors and straight Structural Walls.' when the floor has Structure Path Reinforcemen.

So I want to know which curve is span direction, and set span direction to other curve when I delete span direction curve.

 

Is there a way to know?

0 Likes
614 Views
5 Replies
Replies (5)
Message 2 of 6

Moustafa_K
Collaborator
Collaborator

I believe the span direction curve does not define the slope direction. Therefore, we can use this parameter to determine if the curve is a span curve or not

 

see this example if it can help

 

var modelLines = floor.GetDependentElements(
    new CurveElementFilter(CurveElementType.ModelCurve)
);
List<Curve> curves = new List<Curve>();
foreach (var modelCurveId in modelLines)
{
    var modelCurve = Doc.GetElement(modelCurveId) as ModelCurve;
    var canDefineSlop =
        modelCurve.get_Parameter(BuiltInParameter.CURVE_IS_SLOPE_DEFINING) != null;
    if (canDefineSlop)
    {
        // I am a floor curve
    }
    else
    {
        // I am a Span direction curve
    }
}

 

 

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
Message 3 of 6

qoreodlf37
Enthusiast
Enthusiast

Thanks for your answer.

But canDefineSlop, all curve's canDefineSlop are true.

Do you know other way?

0 Likes
Message 4 of 6

Moustafa_K
Collaborator
Collaborator

yes you are correct if the span Indication is part of the original curve. I was testing it on this case

Moustafa_K_0-1719904043410.png

 

Couldn't find a way to detect which curve, except by getting the bounding box of the model curve. it would reflect a bigger Bounding box than the other similar curve direction.  but still, this is not a reliable method. 

 

I am out of thoughts at the moment

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
0 Likes
Message 5 of 6

qoreodlf37
Enthusiast
Enthusiast
Thank you. I'll find another way!!
0 Likes
Message 6 of 6

qoreodlf37
Enthusiast
Enthusiast

I solve this problem!

double angledirection = selectedFloor.SpanDirectionAngle;

var sketchEditScope = new SketchEditScope(doc, "Add profile to the sketch");
sketchEditScope.Start(floorSketch.Id);

using (var t1 = new Transaction(doc, "trans"))
{
    double tempSpanDirectionAngel = 1;

    t1.Start();
    selectedFloor.SpanDirectionAngle = tempSpanDirectionAngel;
    t1.Commit();

    t1.Start();
    //  Edit floor's Model Curves
    t1.Commit();

    t1.Start();
    selectedFloor.SpanDirectionAngle = angledirection;
    t1.Commit();


}

sketchEditScope.Commit(new FailuresPreprocessor());

 

When I change span direction angel of floor, new angle is created.

And modify floor's model curves, and change span direction anlge to original.

It works!

0 Likes