Hello, thanks for your code. I made some change to suit my application. hear I attached a video, in that video, I have shown my requirement. But I did that in a long way.
I have used three separate rules to get what I need. is there a way to use just one rule to combine all three operations.
steps are,
- Enter a new value for "d1" ( when -> "d0" is driven dim & "d1" is normal dim ),now the "d0" value is driven by the "d1" value.
- In Rule0 > it converts "d1" to driven dim & "d0" to normal dim
- In Rule2 > it execute a expression (d0 = d1 * 2) 'for the new value of "d1"
- In Rule1 > it converts "d0" to driven dim & "d1" to normal dim (reverse of Rule0, to bring it to original state)
Rule0:
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument
Dim oCD As ComponentDefinition
oCD = oDoc.ComponentDefinition
Dim oSketch As PlanarSketch
oSketch = oCD.Sketches.Item(1)
Dim oDim As DimensionConstraint
For Each oDim In oSketch.DimensionConstraints
If oDim.Parameter.Name = "d1" Then ' Indicate the name of the parameter you want to do in the driven dimension
oDim.Driven = True
End If
Next
For Each oDim In oSketch.DimensionConstraints
If oDim.Parameter.Name = "d0" Then ' Indicate the name of the parameter you want to do not in the driven dimension
oDim.Driven = False
End If
Next
Rule2:
d0 = d1 * 2
InventorVb.DocumentUpdate()
iLogicVb.UpdateWhenDone = True
Rule1:
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument
Dim oCD As ComponentDefinition
oCD = oDoc.ComponentDefinition
Dim oSketch As PlanarSketch
oSketch = oCD.Sketches.Item(1)
Dim oDim As DimensionConstraint
For Each oDim In oSketch.DimensionConstraints
If oDim.Parameter.Name = "d0" Then ' Indicate the name of the parameter you want to do in the driven dimension
oDim.Driven = True
End If
Next
For Each oDim In oSketch.DimensionConstraints
If oDim.Parameter.Name = "d1" Then ' Indicate the name of the parameter you want to do not in the driven dimension
oDim.Driven = False
End If
Next
Edit form:

Thanks for your support.