Check if sketch is closed using Revit API

Check if sketch is closed using Revit API

Anonymous
Not applicable
1,191 Views
2 Replies
Message 1 of 3

Check if sketch is closed using Revit API

Anonymous
Not applicable

Currently in Revit, if I use the floor slab tool, I make a sketch loop and press the "finish" button. If the sketch is not a closed loop, Revit gives me an error. I am having my command do a similar thing. The user sketches some model lines in a loop. Is there a method in the Revit API that will check if I have a closed sketch? For example, I want to be able to feed a List<Curve> to this method and it tells me whether the lines are closed or not?

 

I know about the CurveLoop class, can that be used this way?

0 Likes
1,192 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

 To check if sketch is closed or not the following logic can be applied:

 

1. Take the first curve's starting point.

2. Take the last curve's end point.

3. See if they both are same[compare their Location(XYZ)].

4. If they are same its a closed loop else open.

 

 

Thanks & Regards

Sanjay Pandey

0 Likes
Message 3 of 3

Anonymous
Not applicable
Thanks but that only tells me whether one line is connected to another. A solution I figured on my own is to take the list of curves endpoints and order them by their endpoints. Make sure that there are two of each xyz. If there are not, then the loop is open. I was even able to get Revit to show me where the loop is open by finding unconnected points.