0

Please check the below code, when I update the product at last, the dimension values are not reflected in fix constraint. Any idea why is it happening so? but when done manually it is working properly

Sub CATMain()

Dim productDocument1 As ProductDocument
Set productDocument1 = CATIA.ActiveDocument

Dim product1 As Product
Set product1 = productDocument1.Product

Dim parameters1 As Parameters
Set parameters1 = product1.Parameters

Dim dimension1 As Dimension
Set dimension1 = parameters1.Item("910.837802STR\Constraints\Fix.15\Fix.15\pos_rotx")

dimension1.Value = 3.402

Dim parameters2 As Parameters
Set parameters2 = product1.Parameters

Dim dimension2 As Dimension
Set dimension2 = parameters2.Item("910.837802STR\Constraints\Fix.15\Fix.15\pos_rotz")

dimension2.Value = -37.162

Dim constraints1 As Constraints
Set constraints1 = product1.Connections("CATIAConstraints")

Dim constraint1 As Constraint
Set constraint1 = constraints1.Item("Fix.15")

constraint1.ReferenceType = catCstRefTypeFixInSpace

product1.Update

End Sub
braX
  • 11,506
  • 5
  • 20
  • 33
tls
  • 11
  • 2

1 Answers1

0

Setting the ReferenceType to catCstRefTypeFixInSpace resets the position of the constraint. Either remove this line or set this value after updating the assembly/constrain.

Shrotter
  • 350
  • 3
  • 9