Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
Does anyone know the code to repeat block for doing specific action in trail file/mapkey?
I don't think there is any sort of looping functionality in trail files or map keys, based upon the fact that there is none for relations. No "for", "do...while", or "repeat...until" constructs. The execution of commands is analogous to a tape running through a reader. It proceeds straight through the code and your only logical branching is done with "if" statements.
In a-synchronous mode you can easily write your own control structure und use while, for or what ever control structure. This example will open files, give by it full path and generate a STEP or IGES output. With Tcl it is very easy to deal with strings, this makes it easy to manipulate mapkey's.
# # Main Action, Hardcoded here # Input where ever you get the full path from # proc MK_Action {} { set files [list] lappend files c:/CreoTickle/work/models/blower.asm lappend files c:/CreoTickle/work/models/frame.prt lappend files c:/CreoTickle/work/models/nut.prt lappend files c:/CreoTickle/work/models/piston_pin.prt foreach file $files { MK_Quit_Window # Run the Mapkey MK_Change_Dir [file dirname $file] # Or write on the fly a config file # MK_Change_Dir_By_Config_File [file dirname $file] MK_File_Open [file tail $file] MK_File_Save_As STEP } MK_Quit_Window }
The complete code can be found in Mapkeys - Use Mapkey in Asynchronous mode
Using this is helpful for beginners, but at the end you don't have really a function feedback (Return code), and the map key's may change from version to version. But if you have a mapkey library it's for sure very easy to program. Generate all the mapkey can be time consuming as well.
You can actually do this easily in OpenSource CREOSON (depending on the language you want to use)...
Trail Files are a bit more sensitive ... but Mapkeys seem to work well.
This depends on the language you want to use... but with CREOSON you have many options due to the generic JSON interface. Javascript and Python are good examples of how this is being used currently...
Hope that helps!
Dave
Hi Folks, I have created the web application:
Repeatable Mapkey Generator | How to loop Creo Mapkey - try to check the video tutorials first: