Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Renaming all parts within an assembly, using a suffix/prefix etcà 2

Status
Not open for further replies.

Bacvar

Mechanical
Apr 22, 2004
22
Hello all,

I have come across a problem when re-using assemblies. I have this assembly which is complete with 75 parts & 8 sub-assemblies. I need to use this assembly 4-6 times within a layout (main assembly/product). This assembly (that I need to re-use) will basically stay the same; however, a few things will change within some of the parts (length, height thickness). But, in order to keep these assemblies unique from one another I need to rename each part file name and each part property name in order to stay clear from any ‘part conflict name’ or identical part names over-writing one another.
Is there anyway of getting around this problem? Is there some way to rename all part names and property names by using some kind of “Save all as” command, saving all with a suffix/prefix etc…?
 
Replies continue below

Recommended for you

Hi Bacvar,

If your runing CATIA under Windows OS, you can use a little free software called Advance Replacing Tools, which can do the things you want (meaning to put a suffix/prefix to your original files). This can be done without starting CATIA. After that, you have to recreate your assembly replacing your original files with the new ones. It will take a little time but I'm afraid you don't have any other choice. If somebody else know a better way, I will be glad to know about this.

To change each property name, I think it can be done only using a macro. I now that, because we use a software from TransCAT (called Q-Checker) which have this ability and I believe it works with a summ of macros which can solve different tasks.

Regards
Fernando
 
Hi ferdo,

Thanks for the quick response. I have found the software to rename the Catia file names, however, I am still unsure about how to run the macro to rename the property names along the spec tree. Does this macro need to be purchased, downloaded or created? Also, does this macro work the same way as the 'rename file' software, or does is add a number down the spec tree etc…?

Regards,
Bacvar
 
Hi,

Check this link for Q-Checker: This software can be purchased from them.

Another way is to launch a new product (start with new from..), and replace the old catparts with those one which you changed the names.

You can find replace command by clicking on right button on each catpart name and browse/point for the new one.






Regards
Fernando
 
hi,

Just some info if you want to start scripting...

I would look in that direction :

1) Get the list of the file (part) that need to be duplicated (part A, part B...)

2) Then open the first one, change partnumber and save as ( part A1...) loop till you have as many part as you have sub assy.

3) Get the next file (part B) and go back to step 2

end of first script

Second scipt

1) Get the list of all sub assy

2) Open sub assy1 and replace partA with partA1, partB with partB1... then save product

3) Open sub assy2 and replace partA with partA2, partB with partB2... save product

4) open next assy...

At the end all part are different from one sub assy to the other, and all sub assy are different also.


I didn't try to create those script but i know the first one is OK, for the second i didn't use "replace component" in a script yet.. so i dunno if it works fine.

Have fun

Eric N.

catiav5@softhome.net
 
Eric N. method should work fine.

But you might try creating a product template of the sub-assy that you want similar but different.

Parameterize the parts that you know you want to change then stor this off into a catalog.
When you want to bring in one of these sub-assy's just insert it from the catalog.

You might also need a renaming macro at that point.

 
Hi there

Here is the code for a macro which change the property name of the CATpart (it will be like your file name).

Sub CATMain()
Dim win1 As String
Dim product1 As Product
win1 = CATIA.ActiveWindow.Name
win2 = Split(win1, ".")
win1 = win2(0)
Dim documents1 As Documents
Set documents1 = CATIA.Documents
Set partDocument1 = CATIA.ActiveDocument
Set product1 = partDocument1.GetItem(partDocument1.Name)

product1.PartNumber = win1

product1.Update
End Sub

Regards
Fernando
 
Hello All,

Thanks for all the input.
Fernando, I tried your code for creating the macro. When I try to run the new macro, a Microsoft Visual Basic window opens which says "Run-time error… and gives me the option to 'END' or 'DEBUG'.
Do you know what this means, and do you know why I'm not allowed to run the macro?

Thanks for all the help.

Regards,
Bacvar
 
Hi Bacvar,

This macro works fine for me. I've forgot to mention taht it was made in CATIA v5r11.

Maybe in other versions this macro can hae some problems (its only a supposition).

You can try a debug and see what's going on

Regards
Fernando
 
Hi Fernando,

I debugged the macro and when it was finished it pointed to the fourth line (win1 = CATIA.ActiveWindow.name) Does anything look wrong in that line?
I am running Catia V5R11 right now, so the macro should work for me.

Regards,
Bacvar
 
Hi Bacvar,

I really don't know what to say. Everything looks to be OK and the macro work for me very well. Sorry, but I can't help you any more.

Regards
Fernando
 
Hi Ferdo,

I've come back to my macro problem, and I thought I'd run it by you one more time, just to make sure I'm creating it properly. So here's the procedure on how I tried to create the macro and run it.
1. I went to Tools/Macro/Macros…
2. Clicked on Create…
3. Set the Macro language to MS VBA, and then typed in a name for the new macro (Property rename).
4. Then my new macro name appeared in the list of available macros, so I clicked on it and selected 'Edit'
5. Visual Basic opened, so I copied your code that you gave me into the open screen.
6. Saved it and then exited.
7. Went back into Catia, went to Tools/Macro/Macros… clicked on my new macro name and selected 'run'. And then the run time error appeared.
Am I doing the procedure correct on creating the macro or is this where I'm missing something?

Thanks in advance
Bacvar
 
Hi Bacvar,

Yes, everything is OK. I hope you understood that this macro is working for a catpart not for a catproduct.

First you have to use this macro for each catpart you want to change and after that you can replace components inside a catproduct.

I've tried to create something similar inside a catproduct but I've failed and for the time beeing I don't have enough time to solve the problems.

Regards
Fernando
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor