FilledRegion.GetBoundaries() API bug?

FilledRegion.GetBoundaries() API bug?

AlbertoRosario
Explorer Explorer
993 Views
1 Reply
Message 1 of 2

FilledRegion.GetBoundaries() API bug?

AlbertoRosario
Explorer
Explorer

For Revit 2016 through 2018.

 

Shouldn't frDayZone.GetBoundaries() have the same "Count" quantity as boundaryprofile?

Here's the problem code:Note "Count=0" for iCurveLoopTwoNote "Count=0" for iCurveLoopTwo So, creating a Solid fails with line written like:

    Solid fSolid = GeometryCreationUtilities.CreateExtrusionGeometry(frDayZOne.GetBoundaries(), XYZ.BasisZ, 100000);

Obviously because of an unforeseen problem with the .GetBoundaries() FilledRegion method returning a "Count" of zero.

When attempting to create said Solid with an empty IList<Curveloop> gives error message:

"Input array of CurveLoops is empty. Parameter name: profileLoops"

 

Yet, frDayZone.GetBoundaries()  returns the expected "Count" successfully creates a Solid and executes all the command code, JUST on the FIRST run oddly enough, right after a System.Forms.OpenDialog box is used to load a tag into the document.This only works first time loading the Tag via System.Windows.Forms.OpenFileDialogThis only works first time loading the Tag via System.Windows.Forms.OpenFileDialogIf the command is run again the error with FilledRegion.GetBoundaries() "Count = 0" will occur.

Also, if the command has never been run and the tag already exists in the document, the error occurs.

To repeat, the main question is:

Why is rDayZone.GetBoundaries() returning "Count = 0" instead of"Count=1" like boundaryprofile?

0 Likes
Accepted solutions (1)
994 Views
1 Reply
Reply (1)
Message 2 of 2

AlbertoRosario
Explorer
Explorer
Accepted solution

Figured this out already.

Just needed to wrap this in another "Transaction" and now it works as expected.

Hope this helps others that may get thrown off for a moment like I did.