cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

VB API code to copy assembly along with all its dependetns and all their drawings

jkbaldania
5-Regular Member

VB API code to copy assembly along with all its dependetns and all their drawings

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.

3 REPLIES 3

Hi,

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) ?


Martin Hanák
jkbaldania
5-Regular Member
(To:MartinHanak)

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.

FV
17-Peridot
17-Peridot
(To:jkbaldania)

Hello all,

 

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.

HIH.

FV.

Top Tags