Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Macro for "new from" product 1

Status
Not open for further replies.

TiagoFigueiredo

Industrial
May 22, 2013
494
PT
I need a macro to create the function "New from", for principal product and for it's parts.
I found an way to do, but only for the principal product, all of it's parts remains the same, and I want to create new ones. The principal product and it's parts or products.

Code:
Sub CATMain()

Dim documents1 As Documents
Set documents1 = CATIA.Documents

Dim productDocument1 As ProductDocument
Set productDocument1 = documents1.NewFrom("C:\CATIA Library\STANDARDS\Springs\cilindro a gas\Cilindro a gas.CATProduct")

End Sub

but in this way, only the Cilindro a gas.CATProduct has been performed the new from function. None of it's parts has been performed the new from.

So I want to pass from this:
1_st0ntd.png


to this:
2_pffodp.png


After this, I want to rename all of its parts, and save in a new destination folder.


Tiago Figueiredo
Tooling Engineer
 
Replies continue below

Recommended for you

if CATIA API don't do the job, maybe you should look into managing this "New From" CATIA windows from win API

Eric N.
indocti discant et ament meminisse periti
 
But if I do it with windows, it will be very similar to make a copy from folder to folder. and when I open the CATProduct, all the parts of the product will open from the first file, because it's their address.

Tiago Figueiredo
Tooling Engineer
 
is it what is going on when you manually use the function?

Eric N.
indocti discant et ament meminisse periti
 
ok. I have developed something in the past, it works, but some times makes some bugs...Now I wanted to improve.

In a macro I opened the file with new from, and then make the save as to working folder, all of the parts were changed the part numbers and make the save as for each one. But don't now why, some times the original file was saved with the new generated parts...
I will need to think more how to do it.


Tiago Figueiredo
Tooling Engineer
 
Cilici, outstanding job.
If you can share it with me, I would appreciate very much. I still haven't figure out how to do it.

Tiago Figueiredo
Tooling Engineer
 
Many thanks by your share.

There is an error:

Untitled_ejjbsw.png


Tiago Figueiredo
Tooling Engineer
 
What's your enviroment? OS, CATIA release? is it CATIA single installation, copied and registered or network deployment?

I've tested on a R19, network deployment and I got the same error. On a R21, single installation it worked fine.

The problem comes from SendToService object.

Please drop me a message on LinkedIn to send you the source code.
 
One more for you: do you have PX1 license? It seems that this is your problem.
 
Hi,

I noticed something else. Application is not "seeing" CATIA files from bigger releases then r21? Because for me is not showing in the beginning when you pick a file from a folder CATIA files from r25 but is showing me r21. Win 7 pro, r19,r21,25, v6r2013x - all local installation, 3DEx 2017 cloud (with rich app local).

Regards
Fernando

- Romania
- EU
 
Hello ferdo,

It has nothing to do with CATIA version, unless the extension of R25 files is not CATProduct/CATDrawing anymore :)

Or isn't it?

Calin
 
Cilici, what's a PX1 license?

My CATIA is a plm express version CAT+MCE+HCX

Tiago Figueiredo
Tooling Engineer
 
PX1 - CATIA - PPR PDM Gateway 1

@ferdo: is it included in PLM Express?
 
Thank you Ferdo (very very low resolution) for taking your time.

As stated in the interface: the input files must be CATProduct and/or CATDrawing.

Is this asking your question?

Calin
 
So what can be the main cause for not working with me?

Tiago Figueiredo
Tooling Engineer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top