hello everyone I'm getting an error message that says "This curve will make the loop not contiguous. Parameter name: pCurve"

hello everyone I'm getting an error message that says "This curve will make the loop not contiguous. Parameter name: pCurve"

durrM2JKR
Contributor Contributor
512 Views
5 Replies
Message 1 of 6

hello everyone I'm getting an error message that says "This curve will make the loop not contiguous. Parameter name: pCurve"

durrM2JKR
Contributor
Contributor

I attempted to obtain cureveloop from cureves who were experiencing this issue. Can anyone assist me in resolving this issue?here my code in below


TransactionManager.Instance.EnsureInTransaction(doc)
view = doc.ActiveView.Id

setting = AreaVolumeSettings.GetAreaVolumeSettings(doc)
options = SpatialElementBoundaryOptions()
b_option = setting.GetSpatialElementBoundaryLocation(SpatialElementType.Room)
options.SpatialElementBoundaryLocation = b_option
rooms = FilteredElementCollector(doc,view).OfCategory(BuiltInCategory.OST_Rooms).WhereElementIsNotElementType().ToElements()
curvelist = []
curveilist = List[CurveLoop]()
for room in rooms:
    curve = CurveLoop()
    for bound in room.GetBoundarySegments(options):
        for i in bound:
            curve.Append(i.GetCurve())
    curvelist.append(curve)        
    curveilist.Add(curve)
TransactionManager.Instance.TransactionTaskDone()

OUT = curvelist

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

Moustafa_K
Collaborator
Collaborator

Possible occur: there are 2 loops which you need to separate. for example, a room-bounding object such as (column) inside a room will create 2 loops. the outer loop and the one surrounding this column. Hence, your code needs to consider creating a curve loop per bound and then iterate the curves of the bound to append that relatively.

a quick fix to your code

for room in rooms:

    for bound in room.GetBoundarySegments(options):
    curve = CurveLoop()  //your fix is here
        for i in bound:
            curve.Append(i.GetCurve())
    curvelist.append(curve)        
    curveilist.Add(curve)
Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
0 Likes
Message 3 of 6

durrM2JKR
Contributor
Contributor

Hello, thank you for your help. I'm currently attempting to create a filled region in a room, but I'm getting an error message that says" File "<string>", line 59, in <module>
Exception: Boundaries are self-intersecting.
Parameter name: boundaries"

durrM2JKR_0-1674617371245.png

 

0 Likes
Message 4 of 6

moturi.magati.george
Autodesk
Autodesk

Hi @durrM2JKR,

 

In the Remarks of the CurveLoop, there are specific requirements for how valid CurveLoops must be formed and one of them is that there should be no self-intersections.

 

https://www.revitapidocs.com/2023/84824924-cb89-9e20-de6e-3461f429dfd6.htm

 

 

 

This means that when you are creating your Curve Loop, there are intersections occurring. You can try to initialize your CurveLoop after getting the room

 

 

  Moturi George,     Developer Advocacy and Support,  ADN Open
Message 5 of 6

Revitalizer
Advisor
Advisor
Accepted solution

Hi,

 

try to draw the input curves using DetailCurves or ModelCurves.

 

It may be that the room boundaries you see in the UI are not the same Revit uses internally.

Some time ago, I faced such a difference, especially with a room's corners, which formed self-intersecting loops.

 

WYSIWYG.png

 

Revitalizer

 




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 6 of 6

durrM2JKR
Contributor
Contributor

@Revitalizer thank you for your time and help

0 Likes