Purpose: Creates a new drawing, sets format, adds general view, and sets scale.
! Mapkey for creating a standard drawing
mapkey dwg @MAPKEY_LABELNew Drawing;\
mapkey(continued) ~ Command `ProCmdDrawingNew` ;\
mapkey(continued) ~ Input `new_dwg` `InputOpt` `A4_LANDSCAPE`;\
mapkey(continued) ~ Command `ProCmdDwgNewFromSel` ;\
mapkey(continued) ~ Select `main_dlg_cur` `PH_left_assist` 1 `dwg_ftab`;\
mapkey(continued) ~ Activate `dwg_ftab` `FormatBrowseBtn`;\
mapkey(continued) ~ Select `file_open` `Ph_list_Filelist` 1 `c_frm_a4.frm`;\
mapkey(continued) ~ Activate `file_open` `Open`;\
mapkey(continued) ~ Activate `dwg_ftab` `OK`;\
mapkey(continued) ~ Command `ProCmdDwgViewCreate` 1;\
mapkey(continued) ~ Command `ProCmdDwgViewOrientation` `general`;\
mapkey(continued) ~ Activate `dwg_create_view` `PickPB`;\
mapkey(continued) ~ Command `ProCmdDwgViewScale` ;\
mapkey(continued) ~ Input `dwg_view_scale` `InputOpt` `1`;\
mapkey(continued) ~ Activate `dwg_view_scale` `Accept`;
If you want, I can:
To execute Operating System (OS) scripts within a Creo mapkey, use the @SYSTEM prefix or the OS Script tab in the Mapkeys dialog. Example: Running a Batch File
If you want to run a Windows batch script (e.g., C:\scripts\cleanup.bat) via a mapkey shortcut like cc, the configuration line in your config.pro would look like this:
mapkey cc @MAPKEY_LABEL Run Cleanup Script; @SYSTEM C:\scripts\cleanup.bat; Use code with caution. Copied to clipboard Scripting via the User Interface
Open the Mapkeys dialog via File > Options > Mapkey Settings (or search "mapkey" in the search bar).
Click New and define your keyboard shortcut (e.g., myscript). Go to the OS Script tab. Enter your command, such as: Open a folder: explorer . (opens current working directory) Run a Python script: python C:\path\to\script.py Open Windows Calculator: calc.exe
Click Save to ensure the mapkey persists in your Mapkeys.pro or config.pro file. Key Formatting Rules Creo Parametric - Mapkeys [Configuration]
OS Script mapkey in PTC Creo Parametric allows you to execute external operating system commands (like batch files, Python scripts, or PowerShell) directly from within the Creo environment. Example Syntax You can define an OS Script mapkey manually in your config.pro (or the newer mapkeys.profile in Creo 11) using the PTC Community Code Example:
mapkey run_py @MAPKEY_NAMEExecute Python Script;@MAPKEY_LABELPyScript;\ mapkey(continued) @SYSTEMpython "C:\scripts\my_creo_automation.py"; Use code with caution. Copied to clipboard How to Create via the UI Instead of manual coding, you can use the OS Script tab in the Mapkeys dialog: Mapkeys Settings and enter your desired shortcut (e.g., Navigate to the tab in the Record Mapkey dialog. Type the command you want the OS to run (e.g., C:\temp\cleanup.bat , then immediately click
Save your changes to your configuration file to keep the mapkey for future sessions. Why use OS Scripts? Automation:
Launch batch files that clean up temporary files in your working directory. External Integration:
Open a project tracker or specific network folder related to the active model. Background Tasks: creo mapkey os script example
Run complex data exports or manipulations using Python or VB API without leaving the Creo window. PTC Community Solved: Script - PTC Community
In Creo Parametric, you can use the @SYSTEM keyword within a mapkey to execute external Operating System (OS) commands, batch files, or scripts. This allows you to perform tasks like launching external applications, copying files, or running complex batch processes without leaving the Creo session. Full Mapkey Syntax Example
Below is an example of a mapkey that runs a Windows batch file to back up a file from the current directory. You can add this directly to your config.pro (or mapkeys.pro in Creo 11) using a text editor.
mapkey bkp @MAPKEY_NAMEBackup Script;@MAPKEY_LABELRun Backup Batch File;\ @SYSTEMstart /min C:\\scripts\\backup_model.bat; Use code with caution. Copied to clipboard Components of the OS Script Mapkey To Define a Mapkey - PTC Support Portal
Creating a mapkey that executes an Operating System (OS) script is a powerful way to automate tasks outside of Creo Parametric, such as moving files, running batch scripts, or launching external applications like a calculator. Defining an OS Script Mapkey
You can create these mapkeys through the Creo interface or by manually editing your config.pro (or mapkeys.pro in newer versions like Creo 11). Method 1: Using the Creo Interface Navigate to File > Options > Mapkeys Settings. Click New to open the Record Mapkey dialog box. Assign a Keyboard Shortcut (e.g., calc). Switch to the OS Script tab.
Type the command you wish to execute. For example, to open the Windows Calculator, simply type calculator.exe. Click OK and then Save to your configuration file. Method 2: Manual Syntax for config.pro
If you prefer to edit your configuration file directly, use the @SYSTEM command followed by the OS path or command.
Example 1: Running a Batch FileTo run a script located in a specific directory, use the following syntax. Note that Creo requires double backslashes (\\) to escape standard file paths. mapkey run_bat @SYSTEMcall C:\\Scripts\\cleanup.bat; Use code with caution. Copied to clipboard
Example 2: Using System VariablesYou can make your scripts more dynamic by using Creo-specific system variables like $USERPROFILE or $USERNAME.
mapkey my_script @SYSTEMcall $USERPROFILE\\Documents\\automation_tool.bat; Use code with caution. Copied to clipboard Key Technical Details
The OS Script Tab: This feature allows you to run OS commands without minimizing the Creo window, making it seamless for tasks like copying configuration files into a working directory. Creo Mapkey Example Purpose: Creates a new drawing,
Command Syntax: Use call before a batch file name to ensure the script executes correctly and returns control to Creo once finished.
File Locations: In Creo Parametric 11, mapkeys have moved from config.pro to a dedicated mapkeys.pro file located in the user's %appdata% folder.
Automation Workflow: Advanced users often use OS scripts to generate Trail Files, which Creo can then play back to perform complex modeling actions. About Mapkeys - Creo Parametric - PTC Support Portal
Introduction
Creo, formerly known as Pro/ENGINEER, is a powerful 3D modeling software used by engineers and designers to create complex designs. Mapkeys are a feature in Creo that allows users to automate repetitive tasks by creating custom keyboard shortcuts. In this article, we will explore how to create a Mapkey OS script example in Creo.
What is a Mapkey?
A Mapkey is a keyboard shortcut that can be used to automate a series of tasks in Creo. It allows users to record a sequence of actions and assign them to a single key or a combination of keys. Mapkeys can be used to perform tasks such as creating a new part, assembling components, or generating drawings.
What is an OS Script?
An OS script, also known as an Operating System script, is a type of script that interacts with the operating system to perform tasks. In the context of Creo, an OS script is used to execute a series of commands outside of Creo, such as creating a new folder, copying files, or running a batch program.
Creo Mapkey OS Script Example
Here is an example of a Mapkey OS script that creates a new folder and launches a text editor:
Step 1: Create a new Mapkey
Step 2: Write the OS Script
@echo off
mkdir C:\NewFolder
notepad C:\NewFolder\example.txt
This script creates a new folder called "NewFolder" on the C: drive and launches Notepad with a new file called "example.txt".
Step 3: Configure the Mapkey
Step 4: Test the Mapkey
Conclusion
In this article, we have seen how to create a Creo Mapkey OS script example that interacts with the operating system to perform tasks. By using Mapkeys and OS scripts, users can automate repetitive tasks and increase their productivity in Creo. This is just one example of the many possibilities of using Mapkeys and OS scripts in Creo.
Additional Resources
Here are three practical examples you can implement today. We will focus on Windows Batch files because they are universally accessible in any Creo environment.
If your file path has a space (e.g., C:\My Designs\project.prt), the OS script sees it as two arguments (C:\My and Designs\project.prt).
Fix: In your Mapkey, wrap the variable in quotes. Instead of OS_Script script.bat !, use OS_Script script.bat "!".
Here are copy-paste ready examples to add to your config.pro.
An OS script is an external executable (.bat, .ps1, .vbs, .exe, or .py) that runs on your operating system. Creo can launch these scripts using the PROTECT or SYSTEM functions.
Why combine them?
Thanks very much!
| Jordan | $1.99 | 2021-11-14 |
| Mike | $1.99 | 2021-11-13 |
| Michael | $1.99 | 2021-08-23 |
| davibraga | $1.99 | 2021-07-14 |
| Fronica | $1.99 | 2021-03-20 |
| Agus | $1.99 | 2020-11-11 |
| علي | $1.99 | 2020-08-19 |
| narcisodomingo | $1.99 | 2020-05-14 |
| Jay | $1.99 | 2020-04-30 |
| Jucelito Oliveira Dos Santos | $1.99 | 2020-04-25 |
| Gary Jordan | $1.99 | 2020-04-23 |