Unfold error

Unfold error

b.graaf
Advocate Advocate
636 Views
3 Replies
Message 1 of 4

Unfold error

b.graaf
Advocate
Advocate

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?

0 Likes
637 Views
3 Replies
Replies (3)
Message 2 of 4

adam.nagy
Autodesk Support
Autodesk Support

Hi,

 

I guess some parts necessary for the unfold get loaded when the sheet metal is visible, even if just as part of the assembly document.

 

This limitation has been around for a while: 
http://forums.autodesk.com/t5/inventor-customization/unfold-api-fails-on-inventor-2013-sp1-1/td-p/37...

 

Which Inventor version are you using?

 

Cheers,



Adam Nagy
Autodesk Platform Services
0 Likes
Message 3 of 4

b.graaf
Advocate
Advocate

Hello Adam,

 

Sorry for my late reply and thank you for yours!

 

I am trying this with Inventor 2017.3

 

Best Regards,

Branko.

0 Likes
Message 4 of 4

adam.nagy
Autodesk Support
Autodesk Support

Thank you, Branko!

 

I updated the log with this info.

For your reference, the issue id is #170081



Adam Nagy
Autodesk Platform Services
0 Likes