Hi,
I’m trying to get correct BoundingBox()
Min
points of a curtain wall’s Panels.
The code is:
GeometryElement panelGeometry = e.get_Geometry(options);
foreach (var item in panelGeometry)
{
GeometryInstance geoInst = item as GeometryInstance;
GeometryElement geoElem = geoInst.GetInstanceGeometry();
foreach (GeometryObject geoObject in geoElem)
{
Solid solidObject = geoObject as Solid; // Autodesk.Revit.DB here
XYZ min = solidObject.GetBoundingBox().Min;
double x = min.X;
double y = min.Y;
double z = min.Z;
Point p = Point.ByCoordinates(x, y, z);
pointTest.Add(p);
}
}
So I should get 109 points for 109 panels.
The code seems to be working fine, but the wierd issue is:
-
I have 109 panels, but getting 110 points.
-
36 of the points have really “far off” coordinates.
For example, a “normal” point has the coordinate:
(-0.762, -0.006, -1.321)
The “abnormal” point coordinates directly from my Zero Touch node are:
(-1000000000000000019884624838656.000000000,
-1000000000000000019884624838656.000000000,
-1000000000000000019884624838656.000000000)
While all the “abnormal” ones have the following coordinates:
(-1000000000000000000000000000000.000,
-1000000000000000000000000000000.000,
-1000000000000000000000000000000.000,)
I guess this is some rounding going on when I Points.DeconstructPoint
and rebuild it with Point.ByCoordinates
in Dynamo.
Since in the abnormal results all 3 axes are equal, I’m guessing these are somehow Origin points that also get multiplied by an erronous amount.
My first guess is that there are some stranded points somewhere in the 3D geometry, but I couldn’t find them. I tried zooming out a lot, looking at hidden elements, looking at any stray geometry… nothing came up…
Basically before I run the script, the “zoom all” works fine in the file itself and geometry seems normal. Once I run the script, suddenly the file behaves as if it has really far away geometry, so it moves very little with Pan etc.
The second guess would be that somehow a weird coordinate system is set in the code, and is messing up the results because it’s “too big”.
I’m a bit lost as to how to set the coordinate system in my code. I’m sure I can somehow correct these values, but not sure about which methods or classes to use.
Also, I’m really confused as to how a one-point-extraction operation on 109 panels yields 110 results.
Any ideas?
Thanks