• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

basic macros for catia

  • Thread starter Thread starter vinzone
  • Start date Start date

vinzone

Guest
Hello everyone, I tried to search in the forum but the results are all related to solidworks, so I ask you. in case there is already such a discussion I apologize!

in the technical office where I worked before the senior designer had created catscripts that allowed with just one click to save any file opened in stp. (going to save it in the folder where the catpart/catproduct resided and obviously with the convenience of not switching from file/save by name/etc).

in the same way he had one for pdf, very useful.

I remember opening his catscripts and not finding them too complex at the programming level. I ask you therefore if there is a guide to follow for the creation of such a catscript.

I would have a special request in addition: would there be the possibility to create a catscript that also generates a simple .txt with the properties listed in the catpart? (by property I mean those specified in the window I attached).

I hope not to ask too much, thank you in advance and good week short to all :d
 

Attachments

  • Immagine 2024-04-22 083815.webp
    Immagine 2024-04-22 083815.webp
    46.4 KB · Views: 14
I press that I'm not practical programming so I'll give a few tips but you have to do some tests if it works.
to do it with just one click I imagine created a button that activates a macro, so you can try to create a macro:
instruments/macro/start recording
then run: file/save with name/save as .stp
close registration and save with macro stp name
then go to instruments/personality/macro/
select the macro and /view the properties
choose an icon to please
then select the macro and drag it on the toolbar (not all bars accept it, do some tests)

same thing for pdf, only that you will have to drag the icon into the drawing workbench

Let me know.
 
Thank you, I'm sure he had created some catscripts but if that solves the problem so much of earned. Thanks again!!
 
what he says @gianni It's fine.

alternatively there is also this.

to turn your catparts into step there is already a utility in catia

tools-- > utility
and find a number of utilities including a batch to turn your catparts into dxf-iges-step

to transform catdrawing in pdf and also in dwg I attach this catscript

for your latest request to generate a txt file of catpart properties
there is already default in catia
open your catproduct
then analysis--distinct

select the properties you want to export and you can generate a txt file or an excel file
Let us know
 

Attachments

Thank you very much to you victorious. As for the conversion utility, I already knew it and use it when I have many files in one folder. However, I often have dozens of folders each with a file to be converted inside. at that point it becomes more convenient to open one by one and save by name in stp, that is why I was looking for a "magical" button that would do it automatically. (Save with the same name as the catpart, in the same folder where the catpart resides, but in stp)

As for the gianni solution instead, I have the problem that the macro saves me the file always in the same folder and with the same file name as when I created the macro. I don't want anything wrong.

the catscript that you have kindly passed me unfortunately does not work. I also translated from French the words (now it doesn't work but it does in Italian :d ) to better understand but it makes me mistake.

Finally with regard to the question of properties I have seen that it works pretty well with catproducts but I do not have the chance to do it with the simple catparts. Is there a way for them, too?

thanks for the help :d
 
ciao @vinzonethe macro pdf-dwg returns the error because first you have to create 3 folders
c:\export\tempdrawing (where you go to put your catdrawing)
c:\export\pdf (where the macro will put pdf)
c:\export\dwg (where the macro will put the dwg)
 
Finally with regard to the question of properties I have seen that it works pretty well with catproducts but I do not have the chance to do it with the simple catparts. there is a way for them too
this you can do in the catpart using the project table
create a table using the internal variables of the catpart
and you can generate a txt file or an excel file
 
I'm sorry I can't help you, but unfortunately I don't know the programming. if the macro maintains file name and location I assume that you should change the script where the file name appears and replace it with a code string that refers to the open file and the folder that contains it. I hope someone can help you more.
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top