Anyone know if it is possible to flatten an irregular shape onto a Surface (convert a solid to a projected flat surface)? I want to find the projected area of a shape on any arbitrary plane (to find the worst case).
Hi, can you highlight on your image or provide a sketch of what you are requiring, thanks
I want to find the exposed surface area of the shape from any direction/angle. So a 2ft x 2 ft x 2 ft box when viewed from 0, 90, 180, 270 degrees obviously has a projected area of 4 ft, but what is the projected area of that box when viewed from 28.3 degrees? That is an easy example that could be solved using trig and geometry  what i am after is a script that would put a plane normal to that 28.3 degrees, project and flatten that box onto that plane, and then give me the area of the projection of that shape onto the plane (but obviously using much more complex solid geometry that cannot be solved simply using trigonometry  like a large steel truss )
Ah, so the area within the â€śshadowâ€ť outline when viewed from any direction.
The best Iâ€™ve been able to do is convert the solid to edge curves and project those onto a plane. Should be able to get the perimeter edges from there, but it can still cause problems with internal boundaries.
Update on this  I have been able to get a script that achieves what I was after. Essentially, the procedure is to deconstruct the solid into Faces, then project each face onto a plane at a desired angle. Then, thicken each resulting face into a solid, use solid.byunion to get one total solid (best way i could come up with to deal with overlapping projected faces), then use the solid as a cutting element to cut out the area of the projected shape from a large surface of known area. From that  i can compare the resulting cut surface area to that of the original uncut surface to get the total projected area.
Note that my test case (not shown here in this post for NDA reasons) deconstructed into over 10,000 faces  it takes about 20 minutes to run the whole thing in 5 degree increments  which is still far better than the alternative of rotating and tracing with Filled Regions.
Thanks @Nick_Boyts for your suggestion  that is what led me in the direction to deconstruction to faces.
//Reference Surface that exceeds the extents of the Object and normal to projection direction
s1 = Line.ByStartPointEndPoint(Point.ByCoordinates(0,20,20),Point.ByCoordinates(20,0,20)).Extrude(Vector.ZAxis(),40);
n1 = (s1.NormalAtParameter(0.5,0.5));
p1 = s1<1>.PointAtParameter((0..1..#n)<2>,(0..1..#n)<3>);
b1 = List.Count(p1.Project(o1,n1)<1><2>)>0;
p2 = List.FilterByBoolMask(p1,b1)["in"];
p3 = List.Clean(List.FirstItem(p2<1>),false);
p4 = List.Reverse(List.Clean(List.LastItem(p2<1>),false));
p5 = PolyCurve.ByPoints(Flatten({p3,p4}),true);
Interesting method there. Unfortunately i donâ€™t think it works for what i need because it only captures the envelope. I need both the outer loop and all the inner loops as well.
The other issue I have is that very often Iâ€™m dealing with geometry that doesnâ€™t behave well in Dynamo (IFC imports from Tekla that result in 20003000 solids that fail with Solid.ByUnion due to INCONSISTENT_FACE_RELATIONSHIPS or something along those linesâ€¦).
A section (really an elevation showing the whole as opposed to a cutting section) in the direction in question is the goal. The problem is more complex than the simple shapes in previous responses. The actual problem i am working on is related to steel erection  specifically what is the wind load on a piece that is swinging from a crane hook. In order to solve that i need to find the worst case â€śSail Areaâ€ť of a piece (could be one solid, could be 1000 solidsâ€¦). So i need to find the â€śsolid ratioâ€ť (what percent of the overall boundary projection of a shape is solid vs void) of the piece at any angle and then find which angle gives the worst case wind loading (itâ€™s not a linear relationship either  as a shape becomes more open the way wind loads are calculated changes as well  so the maximum solid area may or may not result in the maximum wind loads).
At this point  i think what may be limiting things is the Dynamo engine itself and itâ€™s efficiency when dealing with massive amounts of geometry and doing geometry intersections and cuts. Getting several thousand pieces of geometry  throwing them all onto a plane, combining all of that into one unified piece of geometry  over and over at 5 degree increments seems to be really taxing on my system resources (Xeon processor, 32 Gb of RAM) since Dynamo seems to feel the need to â€śrememberâ€ť everything it does in the form of a list for use downstream.
This is what really excited me at first about the point projection method @Vikram_Subbaiah suggested as it seemed like it might be more resource friendly  but given the actual scale of the problem and the density of points that would be required to make it accurate (likely 2" spacing) i have my doubts that it will be any better.
My first thought: couldnâ€™t Ladybug do something here? Let the â€śsunâ€ť be the wind and count the amount of light on a plane behind the geometry? Still a TON of calculations though.
My second thought:
The geometry is complex, and the number of calculations is literally infinite as a result. I donâ€™t know if I would have the resources to accomplish this for all calculations.
My third thought:
Keep it simple. You donâ€™t need to get the actual geometry right away, just the direction of the worst case sail area. Here is where that got me:

Bounding box the element, double the scale of the box, and make a surface from all faces, and keep the one with the largest area and no Z component for the normal. Call this the projection plane.

Set up a means of rotating the projection plane about the centerpoint of the bounding box, using a range from 0 to 360, stepping by whatever increment you feel comfortable with. May want to code a slider to control the increment and a true/false to allow for testing of a specific angle. Wind moves in the vertical direction too, so Consider if you care to take that into account and set up a similar set of sliders/booleans if desired  perhaps limiting the direction to something like +/ 15 degrees in most cases.

Make an array of points on the projection plane using a grid structure which can be refined with a slider, again marking this as an input, which will serve as the â€śresolutionâ€ť of your tests. Denser number = slower test, better results. Sliders will allow you to adjust things as you see fit for the pieces.

In a single codeblock, use a raybounce by vector to project the points from the face along the normal (or reversed normal, depending on how you made the plane), and then divide the number of null values by the number of projection points. Because itâ€™s a single calculation for the super large list it will run faster. The math isnâ€™t really accurate, but it works to narrow stuff down.

Sort the list of angles by the percent open using a sort by key function, get the first five indicted, and project the geometry back onto the projection plane by the reversed vector. Build a surface of the projected lines, and get the area. Use that to inform the need for a test of specific areas, or just call it good enough and add a safety factor.
My fourth thought was that I am hungry, and need to consider eating lunch regularly.
Now here is where I get crazyâ€¦
My fifth thought: use the right tool for the job. In this case I would spend a chunk of time looking into Project Fractal to see if it is an option to allow for bulk review of the percent open factors. Inwoiks still do the specific analysis for the five worst case scenarios manually (trust but verify).
Similar to the section idea, you can create a 3d view where youâ€™ve only isolated the desired elements, set the view orientation at different angles and export the view. Then you need to process each image and count the number of colored pixels relative to the number of background pixels. That will give you a surface percentage that you could then use to determine the most critical angle.
Continuing further along this train of thoughts, as long as your image settings and camera distances are all the same, if you know the area from one angle, you could possibly normalize the rest of the results to that area and deduct a rough estimate for the area from all other angles.
Really at this point itâ€™s a question of which way is the fastest and cheapest and gives a satisfactory answer. The method i have built and working at this time (explained in previous post) which gives the most accurate answer and does the solid vs open calculations and takes into account reduction factors and pressure increases due to percentage of openess takes about an hour to run and eats up every piece of memory on my machine, but it works (great excuse to actually leave the office for lunch). Even though it takes a while  it is 100% hands off, which frees the user up for other stuff (though their machine is effectively uselessâ€¦). So in my opinion it is preferable to a manual process of export and trace, dwg hatching, etc even if those methods took half the time  which is debatable.
i am interested to look into Fractal further to see if it might help  would the benefit there be that i would be leveraging the cloud for the resource intensive geometry operations?
Thanks to all for the the suggestions. if anyone has any ideas how to gain some efficiency when doing 20,000+ ProjectOntoPlane and SubtractFrom operations  let me knowâ€¦(Iâ€™ve already dumped the DS methods into Python and put all that into a custom node that can be used as a function).
Hope the fractal stuff works out for you. Been awhile since Iâ€™ve used it, and I recall a few issues with some nodes not being functional or producing weird results. Canâ€™t recall if they were python nodes or custom nodes, or something else. Just be sure to properly define your inputs for the customizer. I do recall that I learned that the hard way.
â€śWhy is the building so skinny and floor to floor height apparently 80 feet or so?â€ť
How to project onto a plane a geometry mesh or surfaces that are not solid, but get the contour lines of the whole mesh?