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

Share your scripts/hacks

Level 8

Share your scripts/hacks

I have been using my free time to study Python scripting so that I could automate tasks at work and improve efficiency. Several of my scripts have been written to make things eaiser in Pro/E so I figured I would go ahead and share them here:

bender

This script was written because several of my colleagues refuse to use Pro/Piping for hydraulic tubes/hoses. Because of this, we had no way of adding CNC bending data to the drawing without remodeling their parts in Pro/Piping. This script attempts to solve that problem by reading in a Pro/E point file and spitting out a CSV file containing the bend data (feed, bend, twist). It is still a work in progress, but I have posted the source code on GitHub:

https://github.com/HyGear/bender

diff-dwg

This script was written at the request of our purchasing department. They were having problems with understanding what changed between revisions on large/busy drawings. The solution was to write a script that compares the PDFs of the two drawings and outputs a JPEG with deleted items highlighted in red and new items highlighted in blue.

https://github.com/HyGear/diff-dwg

proe-snap

This is sort of a poor man's data management system (I use it when I'm away from the office and don't have access to the data management system). The script will scan your working directory and grab the latest revision of every part/assembly/drawing and place them in a subdirectory with the current time stamp. This allows you to grab snapshots during different phases of a design and also allows you to roll back to a specific point very easily.

https://github.com/HyGear/proe-snap

I would love to hear any feedback that people have on my scripts and I would love to see scripts/hacks from other people that help them get things done!

7 REPLIES 7
Highlighted

Re: Share your scripts/hacks

Creo supports Python?

Great contributions!

Re: Share your scripts/hacks

I don't know that it supports Python directly, but you can run Python scripts with the help of a mapkey.

Re: Share your scripts/hacks

It should be possible to connect to Creo's COM API using Python. I am keen to see an example of this if anyone has one.

Re: Share your scripts/hacks

Python supports win32 COM so it should be possible. Here are some examples with Perl which should be very similar to what Python can do:

http://inversionconsulting.blogspot.com/2008/06/proe-vb-api-not-just-for-visual-basic.html

Re: Share your scripts/hacks

Any real example of Python/VB API script??

I tried myself without success:

import win32com.client as win32

asyncconn = win32.gencache.EnsureDispatch("pfcls.pfcAsyncConnection")

conn = asyncconn.Connect(None,None,None,None)

session = conn.Session

Re: Share your scripts/hacks

I am using ANACONDA, and I get the following error:

Import Error: No module Named IpfcAsyncConnection...

Re: Share your scripts/hacks

Creo point relabel

this script will generate a trail file wich when run will rename all labels in offset point table (must be open). I made a executable file for those who do not know anything of python.

Capture.PNG

https://github.com/Osiel-Gaona/creo_point_relabel