Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
martinhoos
654 Views, 5 Replies

Flatpattern

Hello,

i have a Problem with the following code. If i change a sheetmetal part in an assembly, i get this message:

 

Fehler in Regel: Flaeche_Zuschnitt in Dokument: test1.ipt

Das COM-Objekt des Typs "Inventor._DocumentClass" kann nicht in den Schnittstellentyp "Inventor.PartDocument" umgewandelt werden. Dieser Vorgang konnte nicht durchgeführt werden, da der QueryInterface-Aufruf an die COM-Komponente für die Schnittstelle mit der IID "{29F0D463-C114-11D2-B77F-0060B0F159EF}" aufgrund des folgenden Fehlers nicht durchgeführt werden konnte: Schnittstelle nicht unterstützt (Ausnahme von HRESULT: 0x80004002 (E_NOINTERFACE)).

 

 

 

What is wrong with that code?

Thanks in advance.

Regards

Martin

 

 

 

 

 

 

 

Dim oDoc As PartDocument = ThisApplication.ActiveDocument
	If oDoc.DocumentSubType.DocumentSubTypeID = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
    Dim oDef As SheetMetalComponentDefinition = oDoc.ComponentDefinition
    If Not oDef.HasFlatPattern Then
        oDef.Unfold()
    End If
    Dim oFlatPattern As FlatPattern = oDef.FlatPattern
    'Dim dArea As Double = Round(oFlatPattern.TopFace.Evaluator.Area,4) 'use this one for cm^2
    'Dim dArea As Double = Round(oFlatPattern.TopFace.Evaluator.Area * 0.00107639104,4) 'use this one for ft^2
    'Dim dArea As Double = Round(oFlatPattern.TopFace.Evaluator.Area * 100,4) 'use this one for mm^2
    Dim dArea As Double = Round(oFlatPattern.TopFace.Evaluator.Area * 0.0001,3) 'use this one for m^2
    iProperties.Value("Custom", "Flaeche_Zuchnitt") = dArea
	iProperties.Value("Custom", "Einheit") = "QM"
	currentStyle = SheetMetal.GetActiveStyle()
	If (currentStyle = ("AL 0,5")) Then