PickedBox's min property is not point to left-low corner

PickedBox's min property is not point to left-low corner

KM_Yotsuha
Advocate Advocate
526 Views
4 Replies
Message 1 of 5

PickedBox's min property is not point to left-low corner

KM_Yotsuha
Advocate
Advocate

I pick a box from left-upper to right-lower:

KM_Yotsuha_0-1663149492755.png


the min property seems to point to the left-up corner of box

KM_Yotsuha_1-1663149510099.png

 

KM_Yotsuha_0-1663149599302.png

 


why is that?

 

KM_Yotsuha_2-1663149525920.png

 

0 Likes
Accepted solutions (2)
527 Views
4 Replies
Replies (4)
Message 2 of 5

RPTHOMAS108
Mentor
Mentor

If what you are saying is right, then I suspect that the documentation is wrong.

 

When you look at the PickBoxStyle enum it says that it presents a certain type of selection outline based on direction of pick (if set to directional). That would be of no use to the developer if they didn't know which order the points were picked in. They should probably also have avoided the Min/Max terminology.

 

Strange also that they don't have that PickBoxStyle for the method PickElementsByRectangle (where you would expect it to be more useful).

Message 3 of 5

longt61
Advocate
Advocate
Accepted solution

From my past experience with BoundingBox XYZ, I believe the Min Max point of the PickedBox is correct. 

Just like the BoundingBoxXYZ, the default value does not depend on the view direction but it conforms to the BasisX , BasisY, BasisZ of the standard coordinate system. Unfortunately, the PickedBox does not have the transform property like BoundingBoxXYZ, thus, you can not transform it to your desired coordinate. 

I also believe this is quite consistent to what Autodesk has been doing with their internal unit/ coordinate and user units/ coordinate in other product and API such as AutoCAD (WCS and UCS). Besides, when you use API, what you want to know is what are inside the box and the location of the box, which can be relative Min point and Max point to the standard coordinate. 

 

As for @RPTHOMAS108 's reply, I found that the directional style only differentiate the way to determine if an element is inside the box or not (left - right: completely inside, right-left partially inside, which is consistent with user action on Revit), but not the coordinate defining Min point/ Max point.

 

The way I see it, @KM_Yotsuha must have performed the pick box operation on a floor plan view, whose elevation is at 0, and the BasisY points to leftward, BasisX points upward instead of a standard coordinate where BasisX points rightward and BasisY points upward. Adding some view translation/ rotation to consideration, I thinking the result makes sense. 

This is how you pick

pick.png

 

This is how Revit interpret the picked box

revit.png

I could be wrong, though. Looking forward to feedback from you guys.

 

P/s: I have edited the second images for better understanding. 

Message 4 of 5

RPTHOMAS108
Mentor
Mentor
Accepted solution

Two points alone don't form a bounding box in 3D (there is no depth) or even a rectangle without further context of the view system the points were picked within. 

 

In a true Min/Max bounding box system such as you get in BoundingBoxXYZ every ordinate of min is less than the same ordinate of max and vice versa. This occurs because the limits are in line with the local system of the box rather than the global model system i.e. you have to transform the BoundingBoxXYZ limits by its transform to get the actual position of these points in the model. A fair few BoundingBoxXYZ's objects you get from the API have an identity transform* which make them equivalent to the Outline class which has no transform but is understood to be aligned with the global system.

 

The two points picked here with this UI method can't possibly always conform with a true Min/Max since they are global points with the min being the first point picked (it is considered min/max in terms of index not ordinate values perhaps). 

 

I'm not overly familiar with the UI method however from testing I've established the following which may clarify some ambiguities that could have also arisen:

 

  1. The values of the picked points are not based on the coordinate system of the view they are picked on (they are global).
  2. The picked points sit on the plane of the view regardless as to the work plane location set for the view.

 

If you wanted to create an enclosing or crossing selection of elements based on these points (not sure why you would), then it would not be that straightforward. The argument for the bounding box filters is an Outline (which has no transform) meaning the box you establish for these two points based on view orientation and an arbitrary depth into the view would not in some cases be parallel to the Outline required for filtering. The only other option would be to construct a solid however that would only pick up items where a ElementIntersectsSolid filter is applicable.  You would instead save yourself a lot of pointless work and use PickElementsByRectangle.

 

So it is curious why the PickBoxStyle  wasn't used in PickElementsByRectangle method which is where the directional style is actually used. However I think it comes down to the internal method for that is what it is and you can't choose between enclosing only, crossing only or directional (it is just directional for that method). As a user of AutoCAD myself I don't know why you would choose a selection method for selection windows other than directional anyway i.e. it is the best of both worlds. I also like the 'fence' selection method that you unfortunately don't get in Revit.

 

*Is a 4x4 matrix not 4x3 as noted in API documentation, which is a bit pedantic of me to mention but some may wonder how a 4x3 can have an identity property.

Message 5 of 5

longt61
Advocate
Advocate

I am totally agree with you on the global coordinate and the PickElementsByRectangle method. It would be way better if PickElementsByRectangle can have a style like PickBox.

However, the documentation about Min point and Max point of PickedBox insists otherwise. Since the points are global, no matter where or how you pick, the Min point is still the bottom-left-rear of the box, the Max point is still the top-right-front of the box, globally. Therefore, Min point is not the first point you pick and Max point is not the second point you pick, or they might not even be the points you pick at all if you don't click these special location at all.

0 Likes