🎉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

TCL script to load points and forces

User: "Altair Forum User"
Altair Employee
Updated by Altair Forum User

Hi,

 

I am making a TCL script to import a CSV file in Altair HyperMesh. The CSV file contains 7 columns (x-coordinate, y-coordinate, z-coordinate, x-force, y-force, z-force and resultant force). The idea is to run the script, the nodes are created on the coordinates given in the first 3 columns, the node is selected, a force is created on the selected note. (This should run through all the rows of the csv file.)

The code I have until now is the following:

 

lappend auto_path 'C:/Program Files/Altair/2017/hw/tcl/tcllib-1.19/modules'

package require csv
package require struct::matrix

set data [::struct::matrix]
$data add rows 16
$data add columns 7
set csvfile [open 'coordinates-forces.csv']
csv::read2matrix $csvfile data  , auto 
close $csvfile

set rows [data rows]

for {set i 0} {$i < $rows} {incr i} {
*createnode [data get cell 0 i] [data get cell 1 i] [data get cell 2 i]
*createmark nodes 1 i
*loadcreateonentity_curve nodes i 1 1 {data get cell 4 i} {data get cell 5 i} {data get cell 6 i} 0 0 {data get cell 7 i} 0 0 0 0 0
}

 

The error I currently get is 'invalid command name 'data''. Any help would be appeciated.

 

Thanks in advance!

Philip

Find more posts tagged with