need a second set of eyes on script

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Hi,

I am geting a 'invalid command name' error when running the following script. It works fine if I take the procedure away and just run the script stand alone. This script is intended to create a vector at a node from geoms, split into components and name them based on x,y,z (havent added this last part yet). 

Any help is appreciated.

Thank you,

-Clay

 

 

Tcl script error (Tcl/Tk Script) : invalid command name
              'vector_geoms'                                                    
              while executing                                                   
              'vector_geoms $entyp $n $en $l'                                   
              invoked from within                                               
              'set test [vector_geoms $entyp $n $en $l]'                        
              (file 'C:/Users/clay.reakes/Documents/default working
              directory/coding/tools/vctr_gms-test.tcl' line 9)                 
              invoked from within                                               
              'source {C:/Users/clay.reakes/Documents/default working
              directory/coding/tools/vctr_gms-test.tcl}'                        
              ('uplevel' body line 1)                                           
              invoked from within                                               
              '# Compiled -- no source code available                           
              error 'called a copy of a compiled script''                       
              (procedure '::hw::RunTclTkScpt' line 1)                           
              invoked from within                                               
              '::hw::RunTclTkScpt 222'
 

 

 

 

*createmarkpanel nodes 1 'select node'
set n [hm_getmark nodes 1]
*createmarkpanel surf 1 'select surf'
set en [hm_getmark surf 1]

set entyp 'surf'
set l 'test'

set test [vector_geoms $entyp $n $en $l]

proc vector_geoms {entyp n en l} {
    *createmark $entyp 1 $en
    *createmark nodes 1 $n
    *geomvectorcreate $entyp 1 1 -1 1 0 0
    *createmark vector 1 -1
    set $l [hm_getmark vector 1]
    set name $
    append name $l
    puts [subst $$name]
    foreach a [Iist x y z] {
        set l_ $l
        append l_ _
        append l_ $a
        set cmp $a
        append cmp comp
        set $l_ [hm_getentityvalue vector [subst $$name] \'$cmp\' 0]  
        puts $l_
    } 
}

 

(had to replace l in list with an i because of forum formatting)

 

Answers

  • tinh
    tinh Altair Community Member
    edited November 2016

    please move 'proc vector_geom ..' to the begining of tcl file

    any tcl proc must be defined before invoked

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited December 2016

    please move 'proc vector_geom ..' to the begining of tcl file

    any tcl proc must be defined before invoked

    haha worked perfectly! thank you!!