So I've used the API to write a procedure which creates a drawing for each body in a part. It works like this:
* Loop through each body folder
* Select the first body in the folder
* Create a drawing
* Add a view for this body.
* Save and close the drawing.
This is working fine.
I have just tried to expand this so that it uses a flat pattern views for the bodies with a flat pattern. I've tried using CreateFlatPatternViewFromModelView3 and it works for the first view it creates, but I get an error when I try to work with the next IBodyFolder object. Specifically:
The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED))
The error happens at IBodyFolder::GetBodies() but the error is produced when I try to access any of the IBodyFolder methods.
Is SolidWorks cleaning something up before I'm done with it? How do I avoid this error? Or how do I go about doing this another way? It would be easier if I could just use the API to set the "Flat pattern" orientation once I've created the view.
Many Thanks,
George