×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

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

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

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

(OP)
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

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

if you search VBA loop you could find this web site:

http://www.learn.net.au/vba/vba-loops

Eric N.
indocti discant et ament meminisse periti

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

http://www.eng-tips.com/viewthread.cfm?qid=340850

??????........

Try not to expect complete solution to your problem.
We want you to solve this by becoming one of the programmer....

Go to FAQs page you will find links to some materials to go through.



Regards,
Maddy

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources