Message 1 of 4
Unfold error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a piece of C# code, to unfold a sheet metal part.
I would like to unfold it, without opening the file.
The next lines
PartDocument invDoc = _inventApp.Documents.Open(fileToExport, false) as PartDocument; SheetMetalComponentDefinition scd = (SheetMetalComponentDefinition)invDoc.ComponentDefinition; if (scd.HasFlatPattern) { // Something.... } else { try { scd.Unfold(); // Something... } catch { _errorDetected = true; }
This gives me an error on the scd.Unfold() method.
If I change:
PartDocument invDoc = _inventApp.Documents.Open(fileToExport, false) as PartDocument;
to:
PartDocument invDoc = _inventApp.Documents.Open(fileToExport, true) as PartDocument;
the unfold is successfull.
The strange thing is, that if I have an assembly openend en with the code I itterate through all the parts within this assembly, than the unfold method works, if I use the false option in:
PartDocument invDoc = _inventApp.Documents.Open(fileToExport, false) as PartDocument;
But if I am in document X and try the code on document Y, then I have to use the "true" option....
Somebody an idea?