Error ilogic - Recognize bendings

Error ilogic - Recognize bendings

Anonymous
Not applicable
1,368 Views
22 Replies
Message 1 of 23

Error ilogic - Recognize bendings

Anonymous
Not applicable

Hi,

 

I use the ilogic code below to recognize if there are bendings in a sheet metal file.

The result is put in a costum iproperty (Bend exist /  No bend exist.

The code does what it has to do..

 

Public Sub Main()
Dim a As Inventor.Application
a = ThisApplication

Dim b As PartDocument
 b = a.ActiveDocument
'Dim b As Inventor.Document
'b= thisdoc.document
Dim sm As SheetMetalComponentDefinition
sm = b.ComponentDefinition

MsgBox (sm.Bends.Count)
Dim customProp As Inventor.Property
On Error Resume Next
customProp = b.PropertySets.Item(4).Add("Bend Exist", "Bending")

If Err.Description Then
	Err.Clear
End If
customProp = b.PropertySets.Item(4).Item("Bending")

If sm.Bends.Count > 0 Then

customProp.Value = "Bend Exist"

Else If sm.Bends.Count = 0 Then	

customProp.Value = "No Bend Exist"

End If
End Sub

But I get the following error message while saving a assembly with a sheet metal file.

Is there anyone who can help me to solve this?

Error in rule: Bending, in document: 24783.ipt

Unable to cast COM object of type 'System.__ComObject' to interface type 'Inventor.PartDocument'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{29F0D463-C114-11D2-B77F-0060B0F159EF}' failed due to the following error: Interface wordt niet ondersteund (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

Thank you in advance!

 

Regards,

Jeffrey

 

0 Likes
Accepted solutions (1)
1,369 Views
22 Replies
Replies (22)
Message 21 of 23

Sergio.D.Suárez
Mentor
Mentor

As it says @bradeneuropeArthur  tries to activate the rule with any change of parameter of the model or any change of geometry of the part

1.jpg


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes
Message 22 of 23

nisse
Explorer
Explorer

I accidentally sent this message from other accounts.

0 Likes
Message 23 of 23

Anonymous
Not applicable

Hi,

 

This time from the right account.

Please find below a printscreen of the structure.

 

Vault structere.png

 

@bradeneuropeArthur 

I'll get the same error when I save the template in de design directory..

 

Regards,

Jeffrey

 

 

0 Likes