Message 1 of 23
Not applicable
02-22-2019
06:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
Solved! Go to Solution.


