Hello, the solution to this problem would be of very high use.
Is there a VB API code to copy assembly along with it's dependent parts and assembly drawing to new name ?
Following things I have already tried:
1) Copied assembly model and it's dependent parts with IpfcModel.CopyAndRetrieve (see code in attachment). But the problem is that, although assembly and all it's dependent parts get copied, the newly copied assembly does not contain newly copied dependent parts in it's model tree.
2) To facilitate copy of models along with model drawings, I set config option "rename_drawings_with_object" to "both". It works totally fine - after copying just a model, drawing also gets copied to the same name as model along with dependency. But, the limitation is : only the drawing whose name is same as that of model gets copied.
Solutions not preferable for me are:
1) After copying assembly and its parts, run the code to replace all old parts in new assembly with new parts (e.g. using IpfcComponentFeat.CreateReplaceOp )
2) After copying assembly, drawings and its parts, run the code to replace old models with new models in drawing.
In short, what I want is a smart procedure to copy assembly along with all its dependents and drawings.
I gues there is a simple solution available for end customers - buy, install and use Windchill PDMLink. Why to spend money on developing auxialiary application (reinventing a wheel) ?
In windchill pdm, we have to collect the dependent objects manually during save as procedure. Actually we have many CAD automation products for creo which imports assemblies from windchill. all these applications at the end need to copy the newly created assemblies and their drawing. if we have VB API solution, it will equip our applications with automation of final step of save as too.
Putting API wrappers over Creo UI utilities which are not doing what you would like them to do in the first place makes things going in a circle...
What needs to be done is to write an app which uses 'low-level' API's.
In essence the workflow should be something like this:
- write a class using System.IO to keep track of the existing models/drawings file-directory layout.
- retrieve all models and drawings in question into session, take care of merge, inheritance, family table, pro/program controlled models and their ref models.
- backup models and drawings into some directory - this will flatten up your directory structure, update your class data.
- close all windows, erase models and drawings from the session.
- retrieve all models/drawings from the storage directory.
- rename as needed, update your class data.
- backup everything again.
- close all windows, erase models
- use your class to restore existing file-directory layout with renamed models and drawings from the storage directory.