Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Dear Sirs,
I hope this message finds you well.
I am reaching out regarding the Creo drawing inspection function shown in the attached image. This function automatically generates a dimension report and allows for the export of dimension data to an Excel file via the "Export to XLS" button.
I am looking to automate this process using Creo TOOLKIT, specifically to automatically extract dimensions and generate the report. However, I am not very experienced with programming.
I would greatly appreciate any guidance, tips, or code examples on how to achieve this. Thank you in advance for your assistance!
Best regards,
Lan Haydena
Hi @Haydena
Thank you for your question!
Your post appears well documented but has not yet received any response. I am replying to raise awareness. Hopefully, another community member will be able to help.
Also, feel free to add any additional information you think might be relevant.
Best regards,
There is not a lot of feedback here. For what it worth, to give you a clue how this could work!
#
# export only a dimension value from type diameter
# add tolernce values and inspection basic info
# sample out (of course out is without the '#')
# Symbol,Value,TolL,TolH,Inspection,Basic
# d2,32.000,0.005334,0.005334,No,No
# d12,5.334,0.005334,0.005334,No,No
# d27,10.667,0.005334,0.005334,No,No
proc SimpleByType {model {sep {,}}} {
set B(0) No
set B(1) Yes
set dims [ps_dim list -model $model]
set out [file join [ps_pwd] dim-info-by-type--$model.csv]
set fp [open $out w]
puts $fp "Symbol,Value,TolL,TolH,Inspection,Basic"
foreach item $dims {
# assign id sym val to a var from the list item
foreach {id sym val} $item break
# get the dim Object handle
set dimObj [ps_dim from_ids $id]
if {[string equal [$dimObj cget -type ] DIAMETER ] } {
# get the tolerance
set tol [$dimObj cget -tolerance ]
# assign lower, upper value
set toll [lindex $tol 0 ]
set tolu [lindex $tol 1 ]
#export if inspection or basic
set insp [$dimObj cget -inspection ]
set basic [$dimObj cget -basic ]
set data [join [list $sym [format %.3f $val] $toll $tolu $B($insp) $B($basic)] $sep]
puts $fp $data
}
}
# close the file
close $fp
}
Just plain Tcl
Just plain Tcl
Good... But ho to use this example?
Hmm, check the Tcl Wiki, write a Mail, get the env, be surprised 😉