boundingBox is an empty Outline.

boundingBox is an empty Outline.

russ.green
Advocate Advocate
3,732 Views
9 Replies
Message 1 of 10

boundingBox is an empty Outline.

russ.green
Advocate
Advocate

I want to pick region (rectangle) in a plan for to get the X and Y min max values to form part of a bounding box.  I'm using pickbox and the min max Z values from a selected topo surface.

 

I defenely have min max XYZs and creating a new outline to use with toposurface.FindPoints(outline). 

 

Dim sourceOutline As New Outline(min, max)
ptsExisting = TryCast(topoSource.FindPoints(sourceOutline), List(Of XYZ))

 

I've done this successfully elsewhere but but with this method I'm getting an error of

boundingBox in an empty Outline.

Parameter name: boundingBox

 

Can someone explain what this error means?  I definatelely have points in the topo within the bounding box.  Is this error saying there is a problem with the outline or that the points are not being found?

Russ Green
0 Likes
Accepted solutions (1)
3,733 Views
9 Replies
Replies (9)
Message 2 of 10

jeremytammik
Autodesk
Autodesk

Dear Russ,

 

One very frequent error is to make a modification to the database and then query for results before regenerating the model, so the modifications have not been processed yet:

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.33

 

Could that be a possible reason for the behaviour you observe?

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 10

russ.green
Advocate
Advocate

I don't think so.  I'm not modifying anything before this code is called.

Russ Green
0 Likes
Message 4 of 10

russ.green
Advocate
Advocate
Accepted solution

I had to re-order the pickbox points. Just relying on pb.min and pb.max wasn't enough.

Russ Green
Message 5 of 10

sgermanoZ2Y2F
Enthusiast
Enthusiast

Hi Russ Im having the same issue, how did you resolve? I keep getting this error: "Bounding box cannot be empty"

0 Likes
Message 6 of 10

jeremytammik
Autodesk
Autodesk

Have you tried sorting the points as suggested above so that Min is smaller than Max?

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 7 of 10

sgermanoZ2Y2F
Enthusiast
Enthusiast

Yup that worked!

0 Likes
Message 8 of 10

aclarke
Advocate
Advocate

How is everyone sorting their min max?

 

public static Outline Outline(UIDocument uidoc)
        {
            Selection selection = uidoc.Selection;
            PickedBox pickedBox = selection.PickBox(PickBoxStyle.Directional);

            double minX = pickedBox.Min.X;
            double minY = pickedBox.Min.Y;

            double maxX = pickedBox.Max.X;
            double maxY = pickedBox.Max.Y;

            minX = Math.Min(minX, maxX);
            minY = Math.Min(minY, maxY);

            maxX = Math.Max(minX, maxX);
            maxY = Math.Max(minY, maxY);

            Outline outline = new Outline(new XYZ(minX, minY, 0), new XYZ(maxX, maxY, 0));

            return outline;
        }

 

Outline outline =  myFunctions.Outline(uidoc);
            double outlineDiagonal = outline.GetDiagonalLength();
            double outlineCenter = outline.GetDiagonalLength()/2;

            TaskDialog.Show("",$"{outline.MinimumPoint}\n{outline.MaximumPoint}\n{outlineDiagonal}\n{outlineCenter}");

 

Bottom Right to Top LeftBottom Right to Top LeftBottom Left to Top RightBottom Left to Top RightTop Left to Bottom RightTop Left to Bottom RightTop Right to Bottom LeftTop Right to Bottom Left

0 Likes
Message 9 of 10

aclarke
Advocate
Advocate

simply creating a new variable for sorted fixed the issue, bad python habit

 

public static Outline Outline(UIDocument uidoc)
        {
            Selection selection = uidoc.Selection;
            PickedBox pickedBox = selection.PickBox(PickBoxStyle.Directional);

            double minX = pickedBox.Min.X;
            double minY = pickedBox.Min.Y;

            double maxX = pickedBox.Max.X;
            double maxY = pickedBox.Max.Y;

            double sminX = Math.Min(minX, maxX);
            double sminY = Math.Min(minY, maxY);

            double smaxX = Math.Max(minX, maxX);
            double smaxY = Math.Max(minY, maxY);

            Outline outline = new Outline(new XYZ(sminX, sminY, 0), new XYZ(smaxX, smaxY, 0));

            return outline;
        }

 

0 Likes
Message 10 of 10

modar.mayyaYT7S7
Participant
Participant

Hi everyone,

 

I am having this problem.

 

Basically, I have a solid and would like to get an outline from it.

 

I calculated all possible min max combinations but they are not always valid to make a non-empty outline. Sometimes all of them result an empty outline.

 

I am sure that the Minimum points are always lower than the Maximum points.

One of the screenshots shows some solids drawn and all possible combinations of min and max.

The ones with vertical small line in the upper half mean that they result empty outlines.

 

The other screenshot shows the debugging values.

 

Information that could be interesting for you. If i get the boundingbox of the solid then try to create an outline with the min max of the bounding box, they work fine but i cannot rely on them because they are not accurate enough.

 

I will appreciate your help.

 

Best regards.
Modar

0 Likes