Tcl for Creo Parametric

Skip to first unread message

Tcl 4 Creo

Jun 7, 2022, 7:42:30 AMJun 7
Now compiled with Creo Parametric 9.0 libs and Tcl 8.6 (no more deprecated Creo Calls in use)
More Info on the Tcl's Wiki and/or Youtube

#Dirty parameter sample, foreach model in session set the parameter MyParam as a String with the value „Hello Tcl“
# This may fail on lock or parameter is not a string
foreach Model [ps::glob *.prt] {
ps::param set -model $Model — MyParam String „Hello Tcl“

# Same Task but More Checks
# Get all part files in session and loop through
foreach Model [ps::glob *.prt] {
# Check if already exists
if { [ ps::param exists -model $Model — MyParam ] } {
# Get the Parameter Handle
set paramObj [ps::param list -model $Model — MyParam]
# If the parameter is a string, else do nothing
if {[string equal [$paramObj get -type] STRING]} {
# Set if we have a different value only
if {[string compare [$paramObj cget -value] „Hello Tcl“]} {
# This may fail on lock (Relation usage), but this can be checked as well
$paramObj config -value „Hello Tcl“

} else {

# Just set the parameter in Creo
ps::param set -model $Model — MyParam String „Hello Tcl“


Reply all
Reply to author
0 new messages