Unknow rule error

Unknow rule error

Remy-intl
Advocate Advocate
323 Views
3 Replies
Message 1 of 4

Unknow rule error

Remy-intl
Advocate
Advocate

 

Hello,

 

I use an Ilogic I use a rule to check if a list "MY LIST" exists in my parts and assemblies files.

I use the trigger to lunch that rules before .ipt and .iam  are saved. With parts and assemblies the rules work well. But If I save some modifications on .ipt or .iam from a drawing (.idw) I have this error. 

 

Message error:  (sorry for the "french")

Erreur de règle: TypeERPListeDéroulante, dans le document 117994.iam

Le membre public 'ComponentDefinition' du type 'DrawingDocument' est introuvable.

 

I think it's come from this line of the code (full rule is below)

oMyParameter = ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters

 

When I save from the idw the active document is a idw and not an iam or ipt.

Normally the code should not run in the idw.
I think saving the .ipt/.iam runs the rule but it runs at the idw level.

 

I don't know how can i get around the problem.

Do you have any ideas?

 

Thanks a lot for your time 🙂

 

 

Dim FileName As String
FileName = ThisDoc.FileName()

If FileName <> "" Then

oMyParameter = ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters


	Try
			otester = oMyParameter.Item("Liste_TypeERP")
		Catch
			oInsulationType = oMyParameter.AddByValue("Liste_TypeERP", "", UnitsTypeEnum.kTextUnits) 
			'make parameter a multivalue list parameter
			MultiValue.SetList("Liste_TypeERP", "Machine", "Dont export to ERP", "Part or sub assembly", "Purchase", "Ghost")
		End Try

 

0 Likes
Accepted solutions (1)
324 Views
3 Replies
Replies (3)
Message 2 of 4

Michael.Navara
Advisor
Advisor
Accepted solution

The issue is in ThisApplication.ActiveDocument. This is document which is currently active in Inventor. It is not necessarily the same document, where you run iLogic script.

Use ThisDoc.Document instead

0 Likes
Message 3 of 4

Frederick_Law
Mentor
Mentor

Do you want it to run in idw?

If not, set the trigger on ipt and iam only.

Not on the idw or All Files.

0 Likes
Message 4 of 4

Remy-intl
Advocate
Advocate

Thanks a lot. It's working well.

0 Likes