Challenge

Week - 12 - Creating the locator, writing and reading the node data

AIM: To create macro for locator, writing and reading node data.

PROCEDURE:

CODE:

*clearmarkall 1 ; *clearmarkall 2
set a .connectors
catch [destroy $a]
toplevel $a
wm title $a "CONNECTORS"
wm geometry $a 200x210+100+300;
wm resizable $a 0 0
wm deiconify $a
#buttons
button $a.01 -text "Collectors" -command collectors ; place $a.01 -x 10 -y 10 -width 180 -height 30
button $a.02 -text "X locator" -command X_loc ; place $a.02 -x 10 -y 50 -width 180 -height 30
button $a.03 -text "Y locator" -command Y_loc ; place $a.03 -x 10 -y 90 -width 180 -height 30
button $a.04 -text "Z locator" -command Z_loc ; place $a.04 -x 10 -y 130 -width 180 -height 30
button $a.05 -text "Z locator" -command Weld ; place $a.05 -x 10 -y 170 -width 180 -height 30

proc collectors {} {
*createmark components 1 "Weld" ;if {[hm_marklength comp 1] == 0} {*createentity components name = Weld}
*createmark components 1 "X_loc" ;if {[hm_marklength comp 1] == 0} {*createentity components name = X_loc}
*createmark components 1 "Y_loc" ;if {[hm_marklength comp 1] == 0} {*createentity components name = Y_loc}
*createmark components 1 "Z_loc" ;if {[hm_marklength comp 1] == 0} {*createentity components name = Z_loc}
}

proc Weld {} {
*clearmarkall 1
*clearmarkall 2
*currentcollector comp "Weld"
*createmarkpanel nodes 1 "select the nodes for spider web rep"
*rigidlinkinodecalandcreate 1 0 0 123456
}

proc X_loc {} {
*clearmarkall 1
*clearmarkall 2
*currentcollector comp "X_loc"
*createmarkpanel nodes 1 "select the primary node "
set prim_node [hm_getmark node 1]
*createmarkpanel nodes 1 "select the target node "
set targ_node [hm_getmark node 1]
*rigid $prim_node $targ_node 156
}

proc Y_loc {} {
*clearmarkall 1
*clearmarkall 2
*currentcollector comp "Y_loc"
*createmarkpanel nodes 1 "select the primary node "
set prim_node [hm_getmark node 1]
*createmarkpanel nodes 1 "select the target node "
set targ_node [hm_getmark node 1]
*rigid $prim_node $targ_node 246
}

proc Z_loc {} {
*clearmarkall 1
*clearmarkall 2
*currentcollector comp "Z_loc"
*createmarkpanel nodes 1 "select the primary node "
set prim_node [hm_getmark node 1]
*createmarkpanel nodes 1 "select the target node "
set targ_node [hm_getmark node 1]
*rigid $prim_node $targ_node 345
}

Reading nodes from a file

proc read_nodes {} {
set filename [tk_getOpenFile -title "Select note info file"]
set fileChanne1Id [open $filename r]
while {[eof $fileChanne1Id] == 0} {
puts [set 1st_nodeCord [gets $fileChannelId]]
*createnode [1index $1st_nodeCord 0] [1index $1st_nodeCord 1] [1index $1st_nodeCord 2];
}
close $fileChannelId
}
read_nodes;

OUTPUT

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.