iLogic : modify and update parameters/iProperties

iLogic : modify and update parameters/iProperties

TONELLAL
Collaborator Collaborator
1,966 Views
8 Replies
Message 1 of 9

iLogic : modify and update parameters/iProperties

TONELLAL
Collaborator
Collaborator
Hello,
I try to modify iProperties or parameters on a model using an iLogic form. The problem is the model is not always updated. For example, I have :
 
If Parameter("Hauteur_TAB") = 2000 Then
'MessageBox.Show(iProperties.Value("AFNOR 60,3 x 4 00000001:1", "Project", "Part Number"), "Title")
iProperties.Value("AFNOR 60,3 x 4 00000001:1", "Project", "Part Number") = "4.7181.0455.0.0"
'MessageBox.Show(iProperties.Value("AFNOR 60,3 x 4 00000001:1", "Project", "Part Number"), "Title")
End If

RuleParametersOutput()
InventorVb.DocumentUpdate()
 

  

The parameter "Hauteur_tab" is modified by a form. If I use the MessageBoxes, I can see the Part Number is modified. But if I check on the part (iProperties), it has always the old value, like if the rule could not send back the result in the part. Sometimes it works, sometimes not...

0 Likes
1,967 Views
8 Replies
Replies (8)
Message 2 of 9

bretrick30
Advocate
Advocate

 

Is this rule in an assembly?  I ask because of the following line where you are setting the iProperty, the red part looks like you are telling the Part Number iProperty for that specific part to change.

 

iProperties.Value("AFNOR 60,3 x 4 00000001:1", "Project", "Part Number") = "4.7181.0455.0.0"

 

 

If the rule is in a part, try just doing this...

 

iProperties.Value("Project", "Part Number") = "4.7181.0455.0.0"

 

Another thing you could try is...

 

If Hauteur_TAB = 2000 Then
'MessageBox.Show(iProperties.Value("AFNOR 60,3 x 4 00000001:1", "Project", "Part Number"), "Title")
iProperties.Value("AFNOR 60,3 x 4 00000001:1", "Project", "Part Number") = "4.7181.0455.0.0"
'MessageBox.Show(iProperties.Value("AFNOR 60,3 x 4 00000001:1", "Project", "Part Number"), "Title")
End If

RuleParametersOutput()
InventorVb.DocumentUpdate()

 

 

0 Likes
Message 3 of 9

xiaodong_liang
Autodesk Support
Autodesk Support

It is a iLogic code within the assembly. It modifies the property of the occurrence. What TONELLAL mentioned is: after modification, the value is correct when he checked it and popped out by message box. But when he checked the iProperties dialog of the occurrence, the value is still the old one.

 

Hi TONELLAL,

 

I also gave a test on a very simple file a couple of times. It works well to me. The value in the iProperties is always updated.  Since you mentioned the behavior does not always occur, could you try to find in which scenario it can reproduce, or is it related with specific data?

0 Likes
Message 4 of 9

TONELLAL
Collaborator
Collaborator

I tried to make a new simplified model to reproduce the problem.I had others problems...

 

The context :

I have an assembly, containing a Frame Generator su-assembly, which contain a single part created by FG.

The assembly contain a custom parameter.

Depending of this parameter value, an iLogic rule (in the assembly) modify the part number of the FG part.

The parameter is modified via an iLogic form.

 

What I had first time (my 1st post) :

  • you modify the parameter using Injventor interface (fx), then you edit the rule, then "Ok" : the part number is modified

or

  •  you modify the parameter using Injventor interface (fx), then in the iLogic browser, right clic "Execute the rule" : the part number is modified

If you modify the parameter using a form, the property is modified during the execution (this is checked by a messagebox), but once finished, if you check the property on the part it is not modified.

 

What I had today :

  • I made a new assembly on the same principle.

The rule is never fired when I modify the parameter, I have to launch it manually. Even if I put event on "modify model parameter" the rule is not fired.

 

  • New test on the original assembly, which has not been modified since the first post : everything is ok !

It seems iLogic cannot be trusted !

0 Likes
Message 5 of 9

Vladimir.Ananyev
Alumni
Alumni

Dear TONELLAL,
Skeleton models often include rather complex internal references that should be taken into account by rules logic.
Will you please upload your simplest test assembly with iLogic rules that could clarify the problem.
Thanks,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 6 of 9

TONELLAL
Collaborator
Collaborator

I send you a very simplified assembly.

The assembly contains only one occurrence named AFNOR, in a Frame assembly.

There is only one parameter modified by the form.  It contains a listbox with 3 values : 1600, 1800 or 2000.

The rule Designation modify the Part Number of the occurrence AFNOR depending of the value in the form :

1600 --> 3333333333

1800 --> 2222222222

2000 --> 1111111111

 

Workflow :

Open the part and display the form.

Modifiy the value and check the Part Number property on the part : It is not modified.

Run the rule manually.

Check the Part number : it is modified !

 

 

0 Likes
Message 7 of 9

Vladimir.Ananyev
Alumni
Alumni

I slightly modified the code of your rule. It works for me.

iLogicVb.UpdateWhenDone = True

Dim Tab As DoubleForEquals = Parameter("Hauteur_TAB")

Dim Result As String = "?"
Select Case Tab
   Case 2000
      Result = "1111111111"
   Case 1800
      Result = "2222222222"
   Case 1600
      Result = "3333333333"
   Case Else
  'do nothing now
End Select

If Result <> "?" Then
   iProperties.Value(MakePath("Frame proto:1", "AFNOR 60,3 x 4 00000001:1"), _
      "Project", "Part Number") = Result
   Beep		
End If

RuleParametersOutput()
InventorVb.DocumentUpdate()

 Cheers,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 8 of 9

TONELLAL
Collaborator
Collaborator

Sorry to tell you... that it is always the same problem ! It seems the rule is not fired when using the form : there is no beep when I modify the value via the form, but if I modify the value via the form then I launch the rule manually it is ok.

0 Likes
Message 9 of 9

Vladimir.Ananyev
Alumni
Alumni

If you replace line

   Dim Tab As DoubleForEquals = Parameter("Hauteur_TAB")

with

   Dim Tab As DoubleForEquals = Hauteur_TAB

your rule will be fired after any changes  of the "blue" parameter "Hauteur_TAB" value.

It doesn't matter if you do it manually in the parameter editor or programmatically via your iLogic form.

Cheers,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes