Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Creo Automation and Macros

Status
Not open for further replies.

jzecha

Aerospace
Jan 20, 2016
235
0
0
US
I come from Catia and have written a ton of codes to help automate the repetitive tasks.

What is the best way to do this in Creo?
I have seen a few options, but I haven't spent a significant amount of time to figure any of them out.

The options I have seen include:
Pro Program, J-Link, AutoIt, p-Shellm, and Mapkeys (which I have used and do not like for very detailed automation.

Some things I would like to do are put in sketches, holes, and pads based on a few inputs (Center Datums, Top, Bottom, Left, and Right side of the blocks.

 
Replies continue below

Recommended for you

Pro/Program - this is exposing the underlying structure of the parametric evaluation scheme. One can affect only existing elements of the model; there are if-then structures to suppress or resume and a few parameter changes, but there are no loops and it cannot be used to create new features or delete existing ones.

J-Link - a bit more like what I expect you have seen in Catia.

AutoIt - an external program that can act just like a user, but PTC doesn't expose a lot of information for feedback. I've used it for automating a bunch of things but not model feature creation.

p-Shellm - I've not heard of it.

Mapkeys - these simply replay key and mouse functions and have no loop, no feedback, no if-then structures. I've used them in conjunction with the Query functions in Creo to reliably select features or layers, but it's not easy. OTOH, with the correct prep I used VBA from Excel to generate complex Mapkeys to create models and then 80% complete drawings saving hundreds of manual hours and ensuring uniformity of the results.

If I had a big project I would look at which has a good following and seemingly good support. It's a follow-on to the also effective Nitro- series of programs - Nitro-Cell, Nitro-BOM, and Nitro-PROGRAM.

One factor that makes this a bit odd is that the original reason Catia has so much programming capability is they did not have the depth of feature creation, particularly of patterns, that PTC started with. One big chunk of the way PTC was originated was to eliminate the need for users to create software to get results. Instead of creating a complex program to add a feature, one can create a UDF (user defined feature) and just add that to the model. The UDF contains all the references needed to place it, so there's far less need to write a lot of code. Since most things about the feature are parametric, one can alter it by just altering the parameter/dimensions after placing it. Many of the programs I've seen automated in other software are tasks like creating staircases or patterns of features.

Instead of creating a program to create a feature - you can create a Mapkey that places a UDF using the Search/Query function to chose named elements in your model. This saves manually choosing the references and avoids getting into the raw feature API which is not well exposed by PTC to anyone. Here's an example of doing something like that with the VB-API (similar to J-Link/Web-Link)
It used to be about $10k to get the Pro/Tool-kit license to get to the raw feature API.

OTOH - I've also seen an example with a company that automated building large welded towers with thousands of weld details, including creating the cut drawings ready for the plasma cutter; so it's not like there isn't room in Creo for automating tasks like that.
 
I appreciate the very detailed break down of all of my options.

I will definitely be looking into Creoson.

I am very interested in your ability to use Excel VBA to create Creo Models and Drawings.
I have a lot of experience with Catia and Excel VBA and would definitely like to pursue something like this.

Could you provide me some simple examples or places i can see how to start doing this?
I would like to do some of this for Models and Drawings.
 
What I did was use the mapkey recorder and trail files to capture individual tasks and then sort through the resulting file to find the essential functionality - PTC records a large amount of extraneous information in mapkeys. Of particular note is that mapkeys and trail files aren't a language. They are recording the UI operations; there is no documentation of the UI to rely on.

Then I created VBA code to generate variations of those recordings.

Since the UI changed at each software revision trail files and mapkeys didn't always continue to work, so it's not reliable to create a large library of complex ones. More typical things PTC tended to keep the old software under the hood, so things like Zoom-In and Zoom-Out worked, but creating features I would not expect to work between major revisions. I don't expect PTC has changed that behavior.

For example of how much fun it can be - suppose one wants to place a symbol on a drawing. If one clicks to do that, when making the recording, Creo records the percentage of apparent screen width that is scaled depending on the aspect ratio of the drawing format, rather than the expected X and Y coordinates in the drawing coordinate system.

Start simple. Make a mapkey that places a single thing and then look at what was recorded. The functional part was not always obvious to me so I would start by deleting anything that didn't look functional.

Oh - the first mapkey to make is one that loads mapkeys so that after you edit them with a text editor you can get Creo to use the new version. You are also not limited in naming the mapkey files; AFAIK Creo doesn't really care about the filename, just the contents.

Also -
 
Status
Not open for further replies.
Back
Top