Change name CATIA macro tutorial + free macro download
This free change name CATIA macro can help you a lot. It’s very simple but very useful. If you like to be very organized this is just the perfect solution for element names. To run this name CATIA macro you need to enter a name for your elements and start the macro. After that, you need to select as many elements you want and macro will change names. For example, if you enter Test, it will go like Test1, Test2 and so on.
Change name CATIA macro code
This CATIA macro is based on this code.
Add-on for VB code is making an error it converts “&” to “&”
Sub CATMain() 'This code is edited and adjusted so you can just copy it in macro editor! 'We must to use InputBox instead of using textbox in Visaul Basic Dim ElementName as string ElementName = InputBox("Please eneter element name") Dim documents1 As Documents Set documents1 = CATIA.Documents Dim Selection As Selection 'We must use multiple selection for elment selection Set Selection = CATIA.Activedocument.selection Dim ElementsArray(0) ElementsArray(0) = "AnyObject" Dim Status As String Status = Selection.SelectElement3(ElementsArray, "Select Elements for name change", False, CATMultiSelectionMode.CATMultiSelTriggWhenUserValidatesSelection, False) 'We must use for loop to Dim i As Single For i = 1 To Selection.Count Selection.Item(i).Value.name = ElementName & "__" & i 'FOR INTERNET EXPLORER USERS ONLY:PLEASE CAHNGE "&AMP" WITH "&" IN YOUR CODE Next End Sub
I made adjustments for code so u can use this code also with CATScript. So you can download Visual Basic version of this CATIA macro or you can make your own with CATScript.
You can download it for free and use it.
If you have any issues feel free to contact me.
Check my YouTube channel for more cool videos CATIA Tutorials or section on this site for free macros.
I really like your blog.. very nice colors & theme. Did you make this website yourself or did you hire someone to do it for you? Plz respond as I’m looking to create my own blog and would like to know where u got this from. many thanks
We tried to send you mail but your mail address is not correct.
Hi Scottie
thanks for good words, i did it by myself, it’s working on WordPress, ColorMag theme and these pictures are done in Photoshop. (with some customization on theme.)
If you have any questions feel free to ask 🙂
If you need my help, i am here too for small fee.
All the best
Hello , thank you for the code , amazing work , but when i try to use it i get “FUNCTION OR INTERFACE MARKED AS RESTRICTED” error on the line “Status = Selection.SelectElement3(ElementsArray, “Select Elements for name change”, False, CATMultiSelectionMode.CATMultiSelTriggWhenUserValidatesSelection, False)”
Can you help me with that ?
Hello, can you maybe send the video of the problem and the macro code, so i can test it, on my mail.
musciharun@hotmail.com
Hi, thanks for the macro. It would save me a ton of time!
I need the marco to add a three digit number with leading zeroes and without the dash.
For example Line001, Line002 exc.
It was easy to remove the “__” from the code, but i can’t manage to change the text format to three leading digits
Can you help me out?
Thanks
Hello Joseph, sry for late answer.
The esiest way i can think of is like this.
You have the loop cpunter (i or any other).
You can put like this if i<10 then name is = "00" & i
if i < 100 then name id "0" & i I hope this can help you.
Please show me how to write macros to replace names in a part.
12345-AA001-01 12345-AA002-01
12345-AA001-02 12345-AA002-02
12345-AA001-03 12345-AA002-03
12345-AA001-04 12345-AA002-04
12345-AA001-05 12345-AA002-05
12345-AA001-06 12345-AA002-06
Please help me replace the body name in a part.
ex
123_AA1_245 -> 123_AB1_245
123_AA1_246 -> 123_AB1_246
123_AA1_247 -> 123_AB1_247
123_AA1_248 -> 123_AB1_248
Hello,
I don’t know, how is this complex, if it’s simple like you write,
You don’t need to replace it, just rename it.
So you go like
Make selection, than create for loop to rename these bodies, use counter to go from 1 to..
I hope this helps
Hello,
I don’t know, how is this complex, if it’s simple like you write,
You don’t need to replace it, just rename it.
So you go like
Make selection, than create for loop to rename these bodies, use counter to go from 1 to..
I hope this helps