Hi everybody
I'm trying to write a macro inside IMinspect module to automatic renumber the comparing points. I can?t to make the counter to the points. Someone could help me please. Some tips, examples ... I tryied to use do while function but didn't work.
Thanks
Best regards
Denis Argentin
:o
What version are you using?
Do you just want to renumber them from 1, 2, 3, ... n?
Here's the code I've been using for quite a while. It renames all selected comparison points.
version "5.0"
#====================================================
# ---- InnovMetric Software Inc.
# ---- Module : IMInspect
# ---- Version : 12.0 ( 12.00.00.3695 )
# ---- Date : Friday, November 04, 2011 - 12:00:00
#----------------------------------------------------
# Written by Jason R. Self of Dimensional Engineering - http://www.Dimensional3D.com/
MACRO END_ON_ERROR ( "On" )
DECLARE new_name
DECLARE name
DECLARE nb_cmp_pt
DECLARE index
DECLARE cnt 1
DECLARE status
MACRO INPUT STRING ( new_name, "Automatic Comparison Point Renaming." ,"Please input the new Comparison Point name.", "cmp pt" )
MACRO INPUT INTEGER ( index, " Automatic Comparison Point Renaming.", "Please input the starting number.",1 )
WINDOW REFRESH ( "Off" )
TREEVIEW COMPARISON_POINT COUNT GET ( nb_cmp_pt )
TREEVIEW OBJECT VIEW HIDE ( )
WHILE $cnt <= $nb_cmp_pt
TREEVIEW COMPARISON_POINT SELECT GET ( $cnt, status )
IF $status == "On"
TREEVIEW OBJECT SELECT PUSH
TREEVIEW OBJECT SELECT NONE
TREEVIEW COMPARISON_POINT SELECT ( $cnt, "On" )
TREEVIEW OBJECT PROPERTIES NAME ( "$new_name $index" )
TREEVIEW COMPARISON_POINT SELECT ( $cnt, "Off" )
++index
ELSE
ENDIF
++cnt
TREEVIEW OBJECT SELECT POP
ENDWHILE
TREEVIEW OBJECT VIEW RESTORE ( )
WINDOW REFRESH ( "On" )
WINDOW REFRESH NOW
Pretty similar to what I had for V11, which renames them all. Thought it would be good to throw this up there anyways.
Quoteversion "4.0"
#Macro Summary
#This macro will rename comparison points
#It will use a base name input from the user as a prefix
#Declare Variables
DECLARE nb_cp
DECLARE prefix "CP"
DECLARE iter 1
DECLARE cp_old_name
#Deterimin number of Comparison Points
TREEVIEW COMPARISON_POINT GET_NB (nb_cp)
#Ask user for prefix
INPUT STRING (prefix, "Comparison Point Name Prefix", "Set a Comparison Point Name Prefix", $prefix)
#Loop from 1 to nb_cp and rename each comparison point
while $iter <= $nb_cp
TREEVIEW SELECT NONE
TREEVIEW COMPARISON_POINT SELECT ($iter, "ON")
TREEVIEW COMPARISON_POINT SURFACE PROPERTIES NAME GET (cp_old_name)
TREEVIEW COMPARISON_POINT SURFACE PROPERTIES NAME ("$prefix $iter", "$cp_old_name")
++ iter
endwhile
Thank u very much all answer me.
I'll try to use the suggestions.
Thanks again !
Best regards
Denis Argentin
:D
Thanks to all
Both suggestions worked perfectly, i just had to make some adjustments according to my need.
Just for information i'm using version 12.0.0.12
Thank you
Best Regards
Denis Argentin :D
Hello!
Don't forget to switch the display, the Treeview and the Command echo Off during macro operation!
Depending on how many Comp-points you have this will increase the speed dramatically:
#### switch display off####
COMMAND ECHO("Off")
WINDOW REFRESH ("Off")
TREEVIEW REFRESH ("Off")
...
..
.
#### switch display on####
TREEVIEW REFRESH ("On")
WINDOW REFRESH ("On")
COMMAND ECHO("On")
TREEVIEW REFRESH NOW
WINDOW REFRESH NOW
### Macro end ###
regards, Oliver
Ok Oliver, thanks for the tip !
regards, Denis Argentin