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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

CREO 2.0 - Macro like function?

GI
5-Regular Member
5-Regular Member

CREO 2.0 - Macro like function?

Hello community,

 

recently I started working for a company that uses CREO 2.0 . 

 

I am currently trying to understand CREO's capabilities regarding "automation".

 

One of the "simple" things I would like to do, I think is well defined in my head but have no idea if there is a relatively simple way to achieve with CREO's built in tools (the company only has CREO Parametric licences).

 

So here it goes:

 

Given:

  • I have previously created a template-part file (PART.PRT) where I have defined a geometry based on 3 reference points P1,P2 and P3.
  • I am currently working on an assembly (ASSY.ASM) where I manually create 3 points (A1,A2 and A3).

At this point I would like to start a macro which would do the following:

 

  1. Browse to the location where the PART.PRT is saved
  2. Import/ assemble PART.PRT into the ASSY.ASM
  3. Activate(?) the part, replace P1,P2, and P3 with A1,A2, and A3 respectively by looking for the specific names (the names will be specified in the code: "look for P1-->replace with A1") (theoretically all other features of the part template should be automatically updated)
  4. Optional: Prompt for saving the PART.PRT with a new name (and the updated geometry)

 

I think something like this is relatively easy in VBA or similar but after experimenting a bit I cannot see a possibility to do it in Pro/Program.

 

I hope someone with more experience can enlighten me.

 

Thanks!!!

 

1 ACCEPTED SOLUTION

Accepted Solutions
dschenken
21-Topaz I
(To:GI)

You can create a User Defined Feature (UDF) that references those points. In the assembly create a new part and then use the UDF placement to refer to the points.

 

If you like, you can use a mapkey or trail file to reproduce the steps.

View solution in original post

6 REPLIES 6
dschenken
21-Topaz I
(To:GI)

You can create a User Defined Feature (UDF) that references those points. In the assembly create a new part and then use the UDF placement to refer to the points.

 

If you like, you can use a mapkey or trail file to reproduce the steps.

GI
5-Regular Member
5-Regular Member
(To:dschenken)

Thank you for the reply  dschenken ! Really helpful and I could make some progress.

 

I kind of managed to  achieve a basic version of what I wanted to do with a UDF.

 

I am currently trying to make a "hybrid" version of UDF and Pro/Program.

 

What I basicaly want to do is the following:

The part which I would like to use as my UDF basis has a basic PRO/Program where the user is prompted to input a number (2 or 3):

 

  • If the number entered by the user is 2 some features are activated 
  • If the number entered by the user is 3 some other features are activated

 

This unfortunately requires that features for both inputs (2 or 3) are already defined at the tree and they are mutually suppressed (when 2 was input by the user, the features for 3 are suppresed and the other way around).

 

 

This works fine at part level.

 

 

The problem now is that I am trying to define a UDF,  and I cannot pick the suppressed features so that everything could also work at UDF level. 

Idealy I would like to insert a UDF and once I click on it, I am first prompted to enter the number (2 or 3) and then I can select my points and based on the number I entered I get the respective features.

 

Would something like that be possible?

 

Thanks!

 

 

 

 

 

 

 

 

 

 

jbob
11-Garnet
(To:GI)

would a family table UDF work for you? you could create two instances, one with the features that go along with selecting 2 and the other with features that go along with selecting 3. this might eliminate the need for pro-program. you will not end up with any suppressed features using the UDF and if you leave the features grouped you could replace the two instances with each other.

GI
5-Regular Member
5-Regular Member
(To:jbob)

Hi jbob,

 

Thanks for the reply.

 

I managed to make it work with a UDF - PRO/Program hybrid after all.

The only thing that is still weird is the counterintuitive nature of this as:

  • I have to first select the UDF related geometry 
  • I am asked after that about the number of features (2 or 3)

 

So this would work for me now but if a colleague would like to use the UDF, they would find it quite confusing.

 

I will try to check whether a UDF with a family  table would improve it.

Best regards

GI

jbob
11-Garnet
(To:GI)

Most likely this is because feature 2 or 3 are suppressed until called by the program, this is when you will need to select more or different references. With a UDF family table you can add all the features with none suppressed, then in the table you add the features as will as the dimensions to these features if you need to modify them. The features in the table you select yes/no to turn them on or off. You do not have suppressed features with a UDF family table, the features that you say no to do not appear in your model.

GI
5-Regular Member
5-Regular Member
(To:jbob)

Thanks jbob, I created a UDF Family table and the procedure is much cleaner. 

For me it works like a charm!

Currently waiting for feedback from colleagues.

 

Best regards

GI

 

Top Tags