Get floor lines except span direction

Get floor lines except span direction

baekdi
Contributor Contributor
492 Views
5 Replies
Message 1 of 6

Get floor lines except span direction

baekdi
Contributor
Contributor

Hi, I want to get floor lines except span direction.

 

I have a floor that have 4 edge lines and a span direction.

 

baekdi_0-1718182734645.png

And I get lines with this code.

Sketch floorSketch = doc.GetElement(selectedFloor.SketchId) as Sketch;
List<ModelCurve> floorModelCurves = new List<ModelCurve>();

foreach (ElementId id in floorSketch.GetAllElements())
{
    Element el = CommonVariable.CurrentDocument.GetElement(id);
    if (el is ModelCurve)
    {
        floorModelCurves.Add(el as ModelCurve);
    }

}

 

floorModelCurves's count is 5 including span direction.

 

I tried to except span direction using model line's Name ("Span Direction Edge")

But in Revit Korean version, the name is not same with in English Version.

 

How can I determine the model line is 'span direction' or not?

0 Likes
Accepted solutions (1)
493 Views
5 Replies
Replies (5)
Message 2 of 6

jeremy_tammik
Alumni
Alumni

Wouldn't it be easier to obtain the floor edges directly from the floor geometry, instead of its sketch? You could retrieve the floor solid, navigate to the top face (facing upwards) and query it for its face and edges. That ought to provide exactly what you are asking for. Have you used RevitLookup to explore the various floor properties and geometry? The newest release of RevitLookup includes new functionality for geometry visualisation:

  

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 6

jeremy_tammik
Alumni
Alumni

Here are two articles by The Building Coder on obtaining the top faces of a wall that might help:

 

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 4 of 6

ctm_mka
Collaborator
Collaborator
Accepted solution

@jeremy_tammikunfortunately element geometry tends to return only the joined solid, which will result in extra lines they may not want.

@baekditwo options, first instead of looking for modelcurves first, look for Model Lines, and filter by Name, heres the Revit Lookup result for a similar slab:

ctm_mka_0-1718209957201.png

Second option revise your code to look at the profile which only returns the four lines:

 

 

 

Sketch floorsketch = _doc.GetElement(testfloor.SketchId) as Sketch;
foreach (CurveArray curvarr in floorsketch.Profile)
{
    foreach (Line test in curvarr)
    {
        floorModelCurves.Add(test);
    }
}

 

 

 

 

ctm_mka_1-1718210119164.png

One caveat to both methods you should be aware of, any interior boundaries will show up in the list.

0 Likes
Message 5 of 6

Moustafa_K
Collaborator
Collaborator

I believe span direction curve does not define slop direction. thus we can take this parameter as medium to define the curve is span curve or not.

see this example

 

 

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)
    {
        curves.Add(modelCurve.GeometryCurve);

    }
    else
    {
        // ignore Span direction curve
    }
}

 

 

let us know your findings

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

baekdi
Contributor
Contributor

I solved this problem with your second option.

And I get curve's Model line ID by curve.Reference.ElementId because I need Model Line id.

 

thank you all!

0 Likes