1

I am trying to edit the part dimension in CATIA by changing the dimension values in the design table in the excel file. Everytime when i change the values i should manually update the part model. I want to update it automatically through VBA code and save it.

I tried

Sub CATMain()
CATIA.DisplayFileAlerts = False
Dim part As PartDocument
Set part = CATIA.ActiveDocument
part.Update
part.SaveAs "D:\E\CSE\.....\Part2.CATPart"
End Sub

and it is not working. How can we update and save it??

user3714887
  • 77
  • 3
  • 16

2 Answers2

5

You called ".Update" on the Document object, not the Part-object! Answer is:

Dim part As PartDocument
Set partDoc = CATIA.ActiveDocument
partDoc.Part.Update
Anho
  • 149
  • 1
  • 5
0

Your Code is correct and it should be working. Do you get any errors?

If you simply want an automatic update try to change your settings ...

Goto Tools->Options Then in the options dialog, goto Infrastructure Tree Node, and expand that and goto Part Infrastructure. Now on the right pane in the General Tab, Make sure you select Automatic for the Updates.

If this doesn't work you could try to the Part.UpdateObject objectToUpdate method to update the individual feature(s) that need to be updated.

GisMofx
  • 982
  • 9
  • 27