Using ILogic to redefine A-Side for Sheet Metal Component
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a large quantity of sheet metal components that are all going into one assembly. They're all completely flat, no bends or anything. My issue is that whenever we go through and generate the flat pattern it can come in upside down, which generates an issue with manufacturing as the parts are sensitive to which side they're on and they're large enough that they're difficult to flip.
My thought was to run a program that would iterate through every component in the main assembly (no sub assemblies) and redefine the flat pattern to a predefined face (in this case the face generated on the extrusion on the side opposite of the sketch of the part from the original "Face" feature)
Unfortunately, I'm getting the ever so useful "Object of type 'System.UInt32' cannot be converted to type 'Inventor.CommandTypesEnum'.", which I believe to mean that I've got a type mismatch error.
The error occurs on the final if statement where I attempt to redefine the flat pattern. This is only inside of the part document right now, I should be able to iterate through the assembly pretty easily later.
Dim oDoc As PartDocument oDoc = ThisApplication.ActiveDocument Dim oCompDef As SheetMetalComponentDefinition oCompDef = oDoc.ComponentDefinition Dim oSheetFeatures As SheetMetalFeatures oSheetFeatures = oCompDef.Features If oCompDef.ASideFaceStatus.ToString <> "kASideUpToDate" Dim oFeature As PartFeature For Each oFeature In oSheetFeatures If oFeature.Type = ObjectTypeEnum.kFaceFeatureObject Then oCompDef.FlatPattern.Redefine(oFeature.SurfaceBodies(0).Faces(0)) Next End If iLogicVb.UpdateWhenDone = True