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: 

Check if sketch is closed using Revit API

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
814 Views, 2 Replies

Check if sketch is closed using Revit API

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?

2 REPLIES 2
Message 2 of 3
sanjaymann
in reply to: Anonymous

 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

Message 3 of 3
Anonymous
in reply to: Anonymous

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.

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community