🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Import from excel

Hello all,

I have a list of coordinate point of coil spring model in excel.

Is there a possibility to import this point coordinate information to Hypermesh so that nodes as well as lines can be generated ? Using tcl command maybe? or notepad files?

Thank you very much in advance.

Find more posts tagged with

Sort by:
1 - 4 of 41
    tinhUser: "tinh"
    Altair Community Member
    Updated by tinh

    Hi there,

    it's a very simple tcl code,

    like this ex.

    your excel file ==> Save as... CSV format:

    xCoord,yCoord,zCoord

    0,0,0

    1,1,0.5

    1.4,1.4,1.0

    ...

    tcl file:

    #read the csv file

    set csvfile [open csvfilename.csv r]

    set NodeList {}

    while {![eof $csvfile]} {

    gets $csvfile line

    set NodeCoords [split $line ,]

    #create the nodes

    if {![catch {eval *createnode $NodeCoords 0}]} {lappend NodeList [hm_entitymaxid nodes]}

    }

    close $csvfile

    #create sprial

    eval *createlist nodes 1 $NodeList

    *linecreatefromnodes 1 2 150 5 179

    ############

    I usually write tcl codes like those

    If you need my help, don't hersitate

    image/emoticons/default_biggrin.png' alt=':D' srcset='/emoticons/biggrin@2x.png 2x' width='20' height='20'>

    rgds,

    @Tinh: Hello, I have almost similar issue.

    I have an excel file (.csv format).I need to retrieve the data in my first column as a list.

     

    I placed my csv file in my TCL script folder and tried your above TCL script i.e.

     

    'set csvfile [open MaterialData Al6063 - Copy.csv r]'

     

     

    'Tcl script error (Tcl/Tk Script) : wrong # args: should be 'open
                  fileName ?access? ?permissions?'                                 
                  while executing                                                  
                  'open MaterialData Al6063 - Copy.csv r'                          
                  invoked from within                                              
                  'set csvfile [open MaterialData Al6063 - Copy.csv r]'            
                  (file 'D:/RWTH/Mini thesis/V6/TCL V4/Untitled3.tcl' line 6)      
                  invoked from within                                              
                  'source {D:/RWTH/Mini thesis/V6/TCL V4/Untitled3.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 219' '

     

    I would be really glad,if you can look at the above issue and reply.

    tinhUser: "tinh"
    Altair Community Member
    Updated by tinh

    Hi,

    it should be :

    set csvfile [open 'MaterialData Al6063 - Copy.csv' r]

    because your file name has space