Hello everyone!
I have a scenario where I need to create a sweep surface with one rail curve.
But the native sw1 operator in GH only gives me Figure 2, but I want the form in Figure 1, so I wrote a simple C#Script: a=Brep. CreateFromSweep(rail, shape, Point3d. Unset, 0, Vector3d. Unset, false, SweepBlend. global, 0,0. 0001, 0, 0,0. 0);
The boolean value SweepBlend.Global determines whether it is in the form of Figure 1 or Figure 2.
So far it looks good, but C#Script outputs the surface as surface and the sw1 operator outputs the surface as Brep, so I don’t get the four edges.
So, is there a kind person who can tell me why this is? What can I do about it?
your sweep 1 script generates an Array of Brep.
And the Array has one item - a single Face Brep.
EDIT ( I was wrong regarding this aspect)
there is some “divideAlongCrease” Functionality when you add Breps to the document.
you might need to SplitKinkyFaces if you need a brep with 4 faces.
My guess - as soon as Brep.IsSurface() is true, the panel (“ToString()”) will claim untrimmed Surface.
add an additional output “b” to your script
b = a.GetType().ToString();
its an array of Brep as the documentation Brep.CreateFromSweep also shows
“Rhino.Geometry.Brep”
the scripting component might filter the result and make sure it returns some valid data. (Item, list, tree)
It might also be the “ToString()” Part of the panel as described above.
Hello tom,Thank you very much for your reply!
I added this line of code as script. As you said,“a” is indeed a brep.
But I need these four creases for my job, so how do I get them?
Thank you again!
this should do the job - maybe fine tune the error-checking.
// Write your logic here
if (blend_type==true)
{
a=Brep.CreateFromSweep(rail,shape,Point3d.Unset,Point3d.Unset,0,Vector3d.Unset,false,SweepBlend.Global,0,0.0001,0,0,0.0);
}
else
{
a=Brep.CreateFromSweep(rail,shape,Point3d.Unset,Point3d.Unset,0,Vector3d.Unset,false,SweepBlend.Local,0,0.0001,0,0,0.0);
}
// check result and split kinky faces
if (a is Brep[] breps)
{
Brep brep = breps[0];
if (brep != null)
{
brep.Faces.SplitKinkyFaces();
a = brep;
}
}