Skip to main content
10-Marble
May 25, 2021
Question

How to update geometry(part) using VBA

  • May 25, 2021
  • 1 reply
  • 3470 views

Hi,

I have certain questions pl. help me in finding solutions

1) How to know whether the installed creo is installed with VB API ( means it supports VB files)

2) I want to create or the modify the part dimensions through VBA (excel) to easily modify the part without doing it manually ( means opening the part and editing the dimensions) will it be possible? if yes if anybody has small example(program or the part running through VBA) it would be great for understanding

3) I want replace the part in assembly using VBA will it be possible to do?

 

Any positive response are welcomed

 

Regards,

Shubham

1 reply

1-Visitor
May 29, 2021

Hi,

1) In your system, navigate to "C:\Program Files\PTC\Creo_4\M060\Common Files\vbapi". (For Creo 4)
If this folder is available then VB API is installed in your system.

2) The only way to change geometry/model dimensions using VB API is using parameters. Using relations you can map dimensions to parameters. 
Use this article as reference to build the automation. you can find the code to change parameter values using VBA API.
https://www.academia.edu/14405592/Methods_to_Automate_CREO_Design_through_VB_API (credits to the author)

Thanks,
Hanson

10-Marble
May 31, 2021

Thank you HanSolo97 for the reply,

If possible could you share that document with me here in the attachment format as its too costly for me to buy.

 

I have one question using VBA is it possible to active or supress any part in the assembly as per the need of the design means i will be having one master model & in that i will be having all the components of having different combinations , if i need certain components then will it be possible to update the dimensions and active or suppress the parts using VBA?

 

Regards,

Shubham Mehta   

1-Visitor
June 3, 2021

Hi,
The answers you are looking for is already available in the community 

To Change model parameters:
https://community.ptc.com/t5/Customization/vb-api-parameters/td-p/143766

 

To Suppress/un-suppress features using Feat ID:
https://community.ptc.com/t5/Customization/Hiding-Suppressing-parts-using-Creo-VB-API/td-p/292002