Hey
Is it possible to make solids by using surface capping in an array of surfaces?
It seems to me that I can only do this one surface at a time. I need a more effective way to do this if possible.
/OutOfTime007
The input only accepts one solid. One way around it is using by function and a simple for loop to go through the list of solids.
Hi All,
I know this is an old discussion,
Being a novice at GC how would I go about using a function to loop through a list of surfaces to cap as solids?or if there are some good tutorials on writing function happy to learn
thanks
Wayne
Hey.
Surface capping multiple solids is a feature that really needs to be implemented in GC. Especially since the function is so simple.
You need to use the solids node and change it to byFunction.
Then in the function you need to write a function that looks something like this:
function (ISurface[] srf) { for (int i = 0; i < srf.Count - 1; i++) { Solid sld = new Solid(this).BySurfaceCapping(srf[i],true,1,0); } };
... and then in your function argument you can just plug in your surface. You should put {} around the name of your surface in the functionargument field.
All it does is look at each solid individually, caps them and puts them in the same node.
Hope it makes sense. It took a long time for me to figure out this simple thing back when I was starting out.
Michael
Hi Michael,
I will add your request to the list of future enhancements. It seems, making the Surface input property replicatable should resolve this. Meanwhile, writing your own loop in Solid.ByFunction will definitely do the job.
Thank you for your suggestion and for helping out Wayne,
Volker
Thank you so much, that works well.
Could I ask how I can extend the function to include the top surface. I noticed it doesn't include the last one.
I will attached a sample.
ThanksWayne
Replicatable would maybe do it, but I try to avoid doing this as it tends to create 2D lists (ie. [][]) and its easier to avoid having those. I don't know if using replication in this case would cause 2D lists that, but at this point it is more of a habbit to avoid using it. The method above will create a single array list.
Hi Wayne,
In the function, remove the minus one from the check in the for loop. Because the counter comparison is "less than" the Count of surfaces, subtracting minus one will omit the last surface in the array.
The function then looks like this:
function (ISurface[] srf){ for (int i = 0; i < srf.Count; i++) { Solid sld = new Solid(this).BySurfaceCapping(srf[i],true,1,0); }};
This should include all surfaces in the array.
Regards,
When dimensionality of arrays gets in the way, you can use <multi-dimensional array>.Flatten() to reduce its dimensionality to a simple one-dimensional array.