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

Error when calling function from external rule, but not when calling from internal rule.

I have an external rule (straight VB) with classes, subs and functions to call from other rules.

In this rule is the following code:

Public Class Glassteun
	Public Property Category As String = "Reynaers_Glassteunen"
	Public Property Name As String
	Public Property Number As String
	Public Property Visible As Boolean
	Public Property Components As IManagedComponents
	Public Property Component As ICadComponent
	
	Public Sub New(Components As IManagedComponents, Component As ICadComponent)
		Me.Components = Components
		Me.Component = Component
	End Sub
	
	Public Function Place() As Inventor.ComponentOccurrence
		Dim oOcc As Inventor.ComponentOccurrence
		'*****This is a workaround for a bug, see this forum post: https://forums.autodesk.com/t5/inventor-programming-ilogic/place-content-center-bug/td-p/12727134*****
		'****************************************************************************************************************************************************************
		Try
			If Name <> "" Then Component.Visible(Name) = True
		Catch
		End Try
		'****************************************************************************************************************************************************************
		'****************************************************************************************************************************************************************
		If Name = "" Then Name = "TempName"
		Components.AddContentCenterPart(Name, Category, Number, Number, , False, , )
		Component.Visible(Name) = Visible
		oOcc = Component.InventorComponent(Name)
		If Name = "TempName" Then oOcc.Name = ""
			
		Return oOcc
	End Function
End Class

 

When I call the place function from an internal rule it works fine, but when I call it from an external rule it fails. This is the code I use to call the function:

AddVbFile "C:\Users\mathijs.stevens\Glas Ceyssens NV\Autodesk Inventor - General\Inventor Instellingen\R2024\iLogicSDK\ContentCenterReynaers.iLogicVb"
' Place/Replace Content Center Member Glassteun
Dim oGlassteun As New Glassteun(Components, Component)
oGlassteun.Name = ""
oGlassteun.Number = "073.7482.00 L"
oGlassteun.Visible = True
oGlassteun.Place

 

And this is the error message I get when calling from an external rule:

Schermafbeelding 2024-05-21 144301.png

As far as I can tell all the arguments are passed correctly so I don't immediately see why this wouldn't work from an external rule.

@MjDeck Could this be a bug?