cancel
Showing results for 
Search instead for 
Did you mean: 

Cloning Again

Builder
Builder

Okay using the UFCLone Api,

How do you specify which parts you want cloned and which parts you want to retain. As of right now it grabs every part that is associated with the Assembly I add. There are some parts that I would like to keep in their original location. Thank you.

5 REPLIES

Re: Cloning Again

Esteemed Contributor
Esteemed Contributor

Have you ever cloned using the interactive clone dialog?

I'd suggest starting there, and playing a bit (if you have docs installed & set up, hit "F1" to get context sensitive help on the dialog)

Once you understand what the options are, see if recording a journal works (I'm not sure if this dialog supports journaling). 

If not, at least you know the terminology - should ebe pretty close to the API terms.

 

Hope this helps...Ken

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Re: Cloning Again

Builder
Builder
It actually doesn't support journaling. And I am familiar with the interactive Dialog.
It all makes sense I am just getting hung up on how to retain specific part files.

Re: Cloning Again

Legend
Legend

I may not be on the right path but instead of using uf_clone_add_assembly which would take all parts in the assembly you should be able to use uf_clone_add_part.  The description for this is

 

This routine adds a part to an initialised clone operation. If the part is an
assembly part, any components of the assembly not already a part of the clone
operation will be added as name only references

 

 

Frank Swinkels

Re: Cloning Again

Valued Contributor
Valued Contributor

I usually use the CloneLog method to clone an assembly (currently in NX8.5 native and in TeamCenter 9)

 

A first Clone run is used to get all necessary parts.

After adding an assy to the this clone operatione I use iterate to determine the required parts.

                ufs.Clone.SetDryrun(false);
                ufs.Clone.AddAssembly(assemblyPath, out load_status);
                load_status.ReportLoadStatus(true);
                ufs.Clone.StartIteration();

                int inx = 0;

                do
                {
                    target = String.Empty;
                    ufs.Clone.Iterate(out path);
                    .....

You can now add rules to each single part in the iteration.

 

I use a collection of class elements which holds the required  informations.

One method of this class forms the text for an entry in the clone log.

 

"...

&LOG Cloning_Action: RETAIN

..."

should lead to your desired result.

 

After writing the clone log you can start a second clone run (the real cloning operation).

 

NXOpen.UF.UFSession.GetUFSession().Clone.Terminate(); // Terminate "SEARCH"-Operation
NXOpen.UF.UFSession.GetUFSession().Clone.ExecuteLogFile(
    NXOpen.UF.UFClone.OperationClass.CloneOperation, CloneLogFile, ref options);

 

 

Hope this helps

Greetings

Herbert Macho
EBNER Industrieofenbau
AUSTRIA

NX10.0.3.5 (TeamCenter10 and Native)

Re: Cloning Again

Valued Contributor
Valued Contributor

Why not do a "save as"? Automate the "save as" for the assembly and components. And skip blanked components for instance if you don't want every component. You could use an attribute too, but hiding for unwanted components is very easy to see. The only thing to watch out for is that afterwards the "saved as" assembly is open in NX. 

W10 NX11.0.1