Skip to main content
15-Moonstone
November 14, 2019
Question

Mapkey export to stl

  • November 14, 2019
  • 2 replies
  • 5749 views

 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 

2 replies

17-Peridot
November 14, 2019

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:

  • (model : open) part
  • execute mapkey (interface : mapkey)

done.

 

Hope that helps - any other suggestions?

 

Dave

15-Moonstone
November 15, 2019

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

24-Ruby III
November 15, 2019

@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

21-Topaz I
November 19, 2019

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. 

17-Peridot
December 4, 2019

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.

15-Moonstone
December 4, 2019

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