Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro to change the Part Number of every Part in a Product

Status
Not open for further replies.

weaselb

Automotive
Jun 30, 2013
2
Hello everyone.

I need to change the PartName and the Instance name of every Part to any number i want, but only the first seven digits should change. I have a macro with wich i can change the Instance name but nothing that can rename the Partname with the Instance name.


The Product has several Parts. They have the following naming structure:
xxxxxxx_A_1_A_ProductName
xxxxxxx_0001_PartName1 (xxxxxxx_0001_PartName1)
xxxxxxx_0002_Partname2 (xxxxxxx_0002_PartName2)
....

I used the recording tool to create a macro and renamed the Part Number of the first Part.
The next step should be a loop, so that the seven digits of the other Parts would change as well. Unfortunately i dont know how to write this loop.

Language="VBSCRIPT"

Sub CATMain()

Dim documents1 As Documents
Set documents1 = CATIA.Documents

Dim partDocument1 As Document
Set partDocument1 = documents1.Item("0000001__0001__Untere_Platte.CATPart")

Dim product1 As CATBaseDispatch
Set product1 = partDocument1.GetItem("0000001__0001__Untere_Platte")

product1.PartNumber = "0000002__0001__Untere_Platte"

End Sub


Is there anything one could do to help me?

Thanks, Rob
 
Replies continue below

Recommended for you

Status
Not open for further replies.

Part and Inventory Search

Sponsor