No warning while Unfolding sheet metal with API

No warning while Unfolding sheet metal with API

darryl.menezes
Contributor Contributor
548 Views
2 Replies
Message 1 of 3

No warning while Unfolding sheet metal with API

darryl.menezes
Contributor
Contributor

Hi,

   I am trying to create Flat pattern of a geometry using Inventor API. But when the flat pattern is created, I can see that the plates are interfering. But yet, I get no warning which says that there is an interference after unfolding. However, when I use the 'Create Flat Pattern' command on Inventor, it shows the warning. Below is the c# code. Is there anything missing? Thanks.

 

                oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}";

                SheetMetalComponentDefinition oSheetMetalDef = default(SheetMetalComponentDefinition);
                oSheetMetalDef = (SheetMetalComponentDefinition)oDoc.ComponentDefinition;                          
                SheetMetalFeatures oSheetMetalFeatures = (SheetMetalFeatures)oSheetMetalDef.Features;
                oSheetMetalDef.UseSheetMetalStyleThickness = false;

                oSheetMetalDef.Thickness.Value = 3;

                oSheetMetalDef.UseSheetMetalStyleMaterial = true;

                oSheetMetalDef.Unfold();

0 Likes
549 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

Any joy with this? I'm experiencing the same issue

0 Likes
Message 3 of 3

darryl.menezes
Contributor
Contributor

Hi,

    You can use the error manager object to detect any warnings. For example, for the above code, we can detect any warnings during unfold as follows:

 

           

            SheetMetalComponentDefinition oSheetMetalDefinition = default(SheetMetalComponentDefinition);
            oSheetMetalDefinition = (SheetMetalComponentDefinition)oDoc.ComponentDefinition;                          
            SheetMetalFeatures oSheetMetalFeatures = (SheetMetalFeatures)oSheetMetalDefinition.Features;
            oSheetMetalDefinition.UseSheetMetalStyleThickness = false;

            oSheetMetalDefinition.Thickness.Value = 3;

           
            
            ErrorManager oErrorManager = ThisApplication.ErrorManager;
            MessageSection oMessageSection = oErrorManager.StartMessageSection();

            Transaction oTransaction = ThisApplication.TransactionManager.StartTransaction((_Document)oPartDoc, "Unfold");

         
            oSheetMetalDefinition.Unfold();
           
            
            if ((oMessageSection.HasErrors) || (oMessageSection.HasWarnings))
            {
                    oMessageSection.AdoptMessages(oErrorManager.LastMessage, true);

                    oTransaction.End();
                    oTransaction.Abort();                   
            }

0 Likes