Hello.
I've written a function to check, if model is sheet metal, or not. The problem is, when the part is a mirror image of sheet metal part, created in the assembly, the code thinks it's not a sheet metal.
Can you help me please?
There is the function.
public bool IsSheetMetal(ModelDoc2 swModel)
{
PartDoc swPart = default(PartDoc);
Body2 swBody = default(Body2);
object[] arrBody = null;
int i = 0;
if (swModel.GetType() != (int)swDocumentTypes_e.swDocPART) return false;
swPart = (PartDoc)swModel;
arrBody = (object[])swPart.GetBodies2((int)swBodyType_e.swSolidBody, false);
try
{
foreach (object body in arrBody)
{
swBody = (Body2)body;
if (swBody.IsSheetMetal() == true) i = i + 1;
}
if (i > 0) return true;
else return false;
}
catch { return false; }
}
SolidworksApi macros