Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Hi,
I've managed to create a mapkey that exports the opened part as *.STL-file. It looks like this:
mapkey ä ~ Close `main_dlg_cur` `appl_casc`;~ Command `ProCmdModelSaveAs` ;\
mapkey(continued) ~ Activate `file_saveas` `SAB_..|`;\
mapkey(continued) ~ Select `file_saveas` `ph_list.Filelist` 1 `CreoToStl`;\
mapkey(continued) ~ Activate `file_saveas` `ph_list.Filelist` 1 `CreoToStl`;\
mapkey(continued) ~ Open `file_saveas` `type_option`;~ Close `file_saveas` `type_option`;\
mapkey(continued) ~ Select `file_saveas` `type_option` 1 `db_549`;\
mapkey(continued) ~ Activate `file_saveas` `chk_customize_export` 1;\
mapkey(continued) ~ Select `file_saveas` `ph_list.Filelist` 1 `Klemme_Neu`;\
mapkey(continued) ~ Activate `file_saveas` `ph_list.Filelist` 1 `Klemme_Neu`;\
mapkey(continued) ~ Activate `file_saveas` `OK`;~ Activate `UI Message Dialog` `ok`;\
mapkey(continued) ~ Update `export_slice` `ChordHeightPanel` `0`;\
mapkey(continued) ~ Activate `export_slice` `ChordHeightPanel`;\
mapkey(continued) ~ FocusOut `export_slice` `ChordHeightPanel`;~ Activate `export_slice` `OK`;;
The mapkey only works when a part is activated, but I want it to work in an assembly:
It has to open every selected part and save it as *.stl.
Is it possible to do that ?
Thanks,
Maik
This can be done pretty easily using CREOSON via Javascript or python
Basically (psudo code):
erase memory
open the assembly you want to process (file : open)
parts = (file : list *.prt);
for each part in parts:
done.
Hope that helps - any other suggestions?
Dave
Thanks a lot, Dave.
I watched the Creoson-installation-video and it seems that J_link has to be installed to use Creoson. I don't know if JLink is installed. Is there a way to check if it is installed or not ?
Thanks,
Maik
@MaikTheBike wrote:
Thanks a lot, Dave.
I watched the Creoson-installation-video and it seems that J_link has to be installed to use Creoson. I don't know if JLink is installed. Is there a way to check if it is installed or not ?
Thanks,
Maik
Hi,
for example ... if Creo 6.0.2.0 is installed with J-Link then you will find following files
C:\PTC\CR6_020\Creo 6.0.2.0\Common Files\text\java\otk.jar
C:\PTC\CR6_020\Creo 6.0.2.0\Common Files\text\java\pfcasync.jar
Thank Martin,
In the Java-Folder there are 2 Folders:
scripts and simulator
and two files:
config.properties, TWXCreoAnalysisProvider.jar
so it seems that J-link isn't installed. Maybe you can tell me, how to install it ?
Thanks,
The CREOSON setup.exe should tell you if JLINK is installed...
If it is not installed, simply update Creo Parametric and install the optional API Toolkits and ensure that Creo Object TOOLKIT Java and Jlink are selected.
Then you should be able to connect and use it.
Dave
@MaikTheBike wrote:
Thank Martin,
In the Java-Folder there are 2 Folders:
scripts and simulator
and two files:
config.properties, TWXCreoAnalysisProvider.jar
so it seems that J-link isn't installed. Maybe you can tell me, how to install it ?
Thanks,
Hi,
during installation you have to click Configure button and select items mentioned by @DavidBigelow
the solution is in your project formulation: there is a requirement for programming / scripting.
Martin suggested JOTK (formerly Jlink) which requires Java and installing the JOTK module (reconfigure your installation if required).
Another solution consists in running ptc_dbatch: this enables to take set of parts stored in a folder and batch run them no more no less.
This article is extensive about this capability that's shipped with Creo and doesn't require programming, scripting skills: https://www.ptc.com/en/support/article?n=CS133096
Finally if you're more comfortable with scripting, you can go for it and leverage the mapkey, but this is another topic.
You could write a mapkey to open a single selected part/assembly, export STL, and close window (if desired). And then manually repeat mapkey on a newly selected part. I often add in the open selected command on many of my export mapkeys just in case people want to export selected from an assembly. If nothing if selected, the mapkey will skip the command. Otherwise you're probably looking at programming to loop through all selected.
Here's some Mapkey Writing/Editing Tips.
Thanks for all of your ideas.
I ended up opening every model and pressing the mapkey to export the file as STL-File.
Creoson really looks nice. I've installed the Java-toolkit in the Creo installation and was able to download and run the Creoson-examples on Creoson website. So Creoson seems to work.
Maybe somebody knows, how I could open every instance of a family table in creoson and export the drawings of these files as .pdf ? And I also would like to Open and render every instance of this family table and save the picture. Is that possible ?
Thanks,
Maik
YES! - CREOSON can easily perform the process you outlined.
The basics of this would be the following in "pusdo code": (assuming active model is the generic you want to process)
// get the list of instance names from the active model
genericModel = file : get_active
instNames = file : list_instances
// export images - not a "render" - but a "render" could done via mapkey most likely for the actual "render" function
foreach instName in instNames
file : open - file = instName, generic = genericModel(rootname)
// optionally set the orientation
view : activate <viewName>
interface : export_image - type - JPEG
// drawings to pdfs (assumes drawing name is same as instance name)
foreach instName in instNames
file : open - instName(rootname)+".drw"
interface : export_pdf
The above workflow would be simple to implement in JavaScript or Python via CREOPYSON.
Hope that is clear enough.
Dave
Thanks a lot for your reply.
In your youtube-videos you seem to use Node.js to run the Javascript-code ? Now I wonder how to set up this environment to use it for creoson on windows 10.
I've downloaded Node.js and hit the install-button. Before the installation it asks me if I want to install some C++-compiler-stuff that is required for some modules.
Do I need this to run Creoson ? I don't want to install something I won't need...
And where can I find the creoson-module that are required for Node.js ?
Are there some more basic examples on how to use creoson with Node.js?
A lot of basic questions... 😃
Thanks,
Maik
Cool - thanks for taking interest in CREOSON!
CREOSON can be simply configured and up and running by running the CreosonSetup.exe. This starts the CREOSON service that will connect to Creo and listen for HTTP requests that can come in from any language using JSON transactions for command/response structures. It is independent of any language/environment you want to use to write your automations with.
Node.js is just one (1) option for working with the CREOSON service. (Node.js is specific to JavaScript). Node.js, VB, Python, etc. are all options for working with CREOSON because CREOSON is just a http interface that passes JSON transactions back and forth to perform operations in Creo. CREOPYSON as an option if you prefer Python - and has a pre-build set of interfaces similar to what you are looking for and has been very well received due to its simplicity.
We have not (yet) put together a formal Node.js library - but you could copy the code that is in our playground.html and run it from Node.js pretty easily. And we have a few other ideas on how to make CREOSON even more approachable for quick things (more on that in a couple of months most likely).
A quick way to play around and do your own thing would be to just copy/paste the playground.html in the CREOSON/web directory and use that code as a reference to build other functions and workflows. If you keep your new file in your CREOSON/web folder you can simply load it in your web browser and make calls to CREOSON from that. I recommend a good HTML editor for this (Sublime is a good choice - and it is also FREE).
Note: CREOSON has a built in HTTP server - so you would be accessing your copied page from http://localhost:9056/<yourNewFile>.html after CREOSON is up and running.
The Playground has a few examples in code that you can see by just simply "Viewing Source" for the HTML document and scrolling down to where the code is (e.g. "<!--CREOSON DEMO CODE-->" script block). It should be pretty obvious - but does require some external libraries to make it work for HTML interfaces (see the script references at the top of the HTML source) since it is a web page. Much of that code updates the HTML interface to inform the user of changes and status... so the actual code would be less than in that playground.html file. It should be failure obvious on how it works... each function is basically a structure that is commonly used ... then you just sequence them together (in our example) for the workflow you want.
You should be able to copy/paste some of the functions in that page to make new ones pretty quickly - e.g. creoOpenModel could be copied to a new function for exporting DXFs, or running a mapkey to export a STL, and then you just have to fill in the proper request object properties.
Note: mapkeys are a bit special... you have to put a delay after you run them to ensure they can complete before your next steps in your code. (e.g. setTimeout... - in javascript) this allows the mapkey to complete before running the next step in your code.
We may develop a special library for Node.js like CREOPYSON did for Python. (that was a great idea by the guy that built that).
After you get things working in HTML (again just playing around and testing) - moving the code to Node.js is pretty easy... but the intent there would be to setup a more production process for doing things (e.g. scheduled task or a service interface that could be tied into other business systems, or a stand alone application that could be distributed and shared - all things which go beyond this response).
Let me know if any of this did not make sense. And thanks for your interest in CREOSON!
Dave