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

VB API: replace part in assembly

Highlighted
Newbie

VB API: replace part in assembly

hi pro

 

i'm trying to replace part A with part B in an assembly model, via VB API.

 

if any body know how to access this task, could you show me the code? i'll very appreciate you

6 REPLIES 6

Re: VB API: replace part in assembly

Example Code: Replacing Instances

The sample code in the file pfcAssembliesExamples.vb located at <creo_vbapi_loadpoint>/vbapi_examples

contains a single static utility method. This method takes an assembly for an argument. It searches through

the assembly for all components that are instances of the model "bolt". It then replaces all such occurrences

with a different instance of bolt.

Re: VB API: replace part in assembly

thanks a lot!

fact is

i have been play with 'vbapi_examples' for days...but i still can't make it works...

i think this example code is used to replace instance of specified part with its another instance.

so i created an assembly model includes a part with instances A and B,but it still doesn't work, throw an exception when app creating instance of new model.

and unfortunately, the model 'replaceinstance.sam' , use for vbapi_examples, is failed.it can't find mated component.

Re: VB API: replace part in assembly

Hello!

About problem 'replaceinstance.sam'.

The way to resolve this: just create new instance at Family table in bolt.prt

The name of new instance must be: PHILLIPS7_8

It is difficult to find the problem, not seeing the code.

Can you share your code, where you call the method from the example? And the model of part with the family table.

Re: VB API: replace part in assembly

woo...thank u ,the model "bolt.prt" can be used correctly "in replaceinstance.asm", but pattern is still incorrect, and i still can not figure it out ...

about the code , in my app, i just used the example code. just changed three arguments:Component Name, Old Instance, New Instance.

could u please send me a repaired model of "replaceinstance.asm"?

and as a fresh bird, may be i expressed my trouble by unclear words, that makes u hard to understand,

thank u for all.


Re: VB API: replace part in assembly

I rebuild the .asm

http://yadi.sk/d/eaP0GXmFLEBY7

But I think, that this file will not help to resolve your problem.

Share the row of code, how you passing arguments:Component Name, Old Instance, New Instance.

Re: VB API: replace part in assembly

thank you!

and sorry that replying so late, got some busy days.

i have downloaded the assembly,but it can not be retrieved...

may i have your e-mail? it is hard describe my code here...