Getting the Floor Profile as Curves or Lines using C#

Getting the Floor Profile as Curves or Lines using C#

ahmadkhalaf7892
Advocate Advocate
1,640 Views
2 Replies
Message 1 of 3

Getting the Floor Profile as Curves or Lines using C#

ahmadkhalaf7892
Advocate
Advocate

Hi Guys.
I wanted to ask how can I get get the sketches of the Floor using C# and then convert them into a Curve so that I can use it for my script. I have been trying to look for a sample unfortunately I couldn't find .
I mean the Pink Lines like in the photo and convert  or use them asCurves.
Thanks .

FLoor Sketch.PNG

0 Likes
Accepted solutions (1)
1,641 Views
2 Replies
Replies (2)
Message 2 of 3

architect.bim
Collaborator
Collaborator
Accepted solution

Hi! You need to get Sketch object from the Floor and take its Profile property. It will contain an array of one or more CurveArrays. By looping through the CurveArray you will have access to every curve in the Profile. And then you can do with them whatever you want.

Sketch sketch = doc.GetElement(floor.SketchId) as Sketch;
foreach (CurveArray curveArray in sketch.Profile)
{
    foreach (Curve curve in curveArray)
    {
        Console.WriteLine(curve.ToString());
    }
    Console.WriteLine();
}

Maxim Stepannikov | Architect, BIM Manager, Instructor
Message 3 of 3

ahmadkhalaf7892
Advocate
Advocate
Thank you very much