The line oSheetMetalCompDef.Unfold or perhaps the line causes Inventor to crash.
I am still having an issue with the script. It uses a naming convention on the part name to assign each part to a material (since the material is lost exporting to Inventor from Fusion). Then the following script is meant convert each part from a solid part to a sheet metal part, ready to be nested by TruNest. We exported our Fusion file to Inventor (using Autodesk Cloud). TruNest accepts Inventor files as input, and expects them to be sheet metal flat parts (I think). Our plan is to send our model into Autodesk TruNest which will efficiently nest all of the parts onto the correct material and add etching labels to each part so that we can find them for assembly. We are going to cut all of the parts out of sheets (8 different material types), all 1.2cm thick. Our final build contains 8 different materials. All the parts are different shapes, but they all have the same thickness, 1.2cm. We have a model we created in Fusion containing 2000+ individual solid parts.