forked from Anwar8/gidopensees
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OpenSees.tcl
1618 lines (1199 loc) · 39.8 KB
/
OpenSees.tcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# GiD + OpenSees Interface - An Integrated FEA Platform
# Copyright (C) 2016-2020
#
# Lab of R/C and Masonry Structures
# School of Civil Engineering, AUTh
#
# Development Team
#
# T. Kartalis-Kaounis, Dipl. Eng. AUTh, MSc
# V.K. Papanikolaou, Dipl. Eng., MSc DIC, PhD, Asst. Prof. AUTh
#
# Project Contributors
#
# F. Derveni, Dipl. Eng. AUTh
# V.K. Protopapadakis, Dipl. Eng. AUTh, MSc
# T. Papadopoulos, Dipl. Eng. AUTh, MSc
# T. Zachariadis, Dipl. Eng. AUTh, MSc
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# TCL macros
#
namespace eval OpenSees {
variable VersionNumber "v2.8.0"
variable InterfaceName [_ " GiD+OpenSees Interface $VersionNumber "]
variable OpenSeesProblemTypePath
variable OpenSeesPath
variable GiDPath
variable GiDProjectName
variable GiDProjectDir
}
proc OpenSees::InitGIDProject { dir } {
global MenuNames MenuEntries MenuCommands MenuAcceler
global MenuNamesP MenuEntriesP MenuCommandsP MenuAccelerP
variable OpenSeesProblemTypePath; # OpenSees problem type directory
variable OpenSeesPath; # OpenSees.exe path
set OpenSeesProblemTypePath $dir
OpenSees::SetOpenSeesPath
OpenSees::SetProjectNameAndPath
SetImagesAndColors
global VerticalAxisChanged
set VerticalAxisChanged 0
global splashdir
set splashdir 0
global keepsplash
set keepsplash 0
OpenSees::Splash $dir
set splashdir $dir
OpenSees_Menu $dir
set ipos [lsearch $MenuNames [_ "Help"]]
if { $ipos != -1 } {
set MenuEntries($ipos) [linsert $MenuEntries($ipos) 0 "Help on OpenSees"]
set MenuCommands($ipos) [linsert $MenuCommands($ipos) 0 [list -np- HelpOnOpenSees $dir]]
set MenuAcceler($ipos) [linsert $MenuAcceler($ipos) 0 ""]
CreateTopMenus
}
set ipos [lsearch $MenuNamesP Help]
if { $ipos != -1 } {
set MenuEntriesP($ipos) [linsert $MenuEntriesP($ipos) 0 "Help on OpenSees"]
set MenuCommandsP($ipos) [linsert $MenuCommandsP($ipos) 0 [list -np- HelpOnOpenSees $dir]]
set MenuAccelerP($ipos) [linsert $MenuAccelerP($ipos) 0 ""]
}
OpenSees::Toolbar1
OpenSees::Toolbar2
OpenSees::Toolbar3
OpenSees::ChangeData
UpdateInfoBar
cd "$OpenSeesProblemTypePath/exe"
# after idle exec {*}[auto_execok start] "CheckForUpdate.exe" "/q" &
}
proc OpenSees::ChangeData {} {
global GidPriv
variable InterfaceName
set GidPriv(ProgName) $InterfaceName
GidChangeDataLabel "Conditions" ""
GidChangeDataLabel "Local Axes" ""
GidChangeDataLabel "Materials" "Materials/Elements Definition"
GidAddUserDataOptions "Loads" "GidOpenConditions Loads" 2
GidAddUserDataOptions "Restraints" "GidOpenConditions Restraints" 3
GidAddUserDataOptions "Constraints" "GidOpenConditions Constraints" 4
GidAddUserDataOptions "Mass/Damping" "GidOpenConditions Mass/Damping" 5
GidAddUserDataOptions "ZeroLength Elements" "GidOpenConditions ZeroLength_Elements" 6
GidAddUserDataOptions "---" "" 8
GiD_DataBehaviour materials Standard_Uniaxial_Materials hide {assign draw unassign impexp}
GiD_DataBehaviour materials Uniaxial_Steel_Materials hide {assign draw unassign impexp}
GiD_DataBehaviour materials Uniaxial_Concrete_Materials hide {assign draw unassign impexp}
GiD_DataBehaviour materials Other_Uniaxial_Materials hide {assign draw unassign impexp}
GiD_DataBehaviour materials Multidimensional_(nD)_Materials hide {assign draw unassign impexp}
GiD_DataBehaviour materials "Section_Force-Deformation" hide {assign draw unassign impexp}
GiD_DataBehaviour materials "Combined_Materials" hide {assign draw unassign impexp}
GiD_DataBehaviour materials "User_Materials" hide {assign draw unassign impexp}
GiD_DataBehaviour materials "Records" hide {assign draw unassign impexp}
GiD_DataBehaviour materials "Beam-Column_Elements" geomlist {lines}
GiD_DataBehaviour materials "Truss_Elements" geomlist {lines}
GiD_DataBehaviour materials Surface_Elements geomlist {surfaces}
GiD_DataBehaviour materials Solid_Elements geomlist {volumes}
GiD_DataBehaviour materials AutoZL hide {assign draw unassign impexp}
GiDMenu::UpdateMenus
}
# Get ProblemType path
proc OpenSees::GetProblemTypePath {} {
variable OpenSeesProblemTypePath
return $OpenSeesProblemTypePath
}
# Set/Get project name and path
proc OpenSees::SetProjectNameAndPath {} {
set lines [GiD_Info Project]
set ProblemType [lindex $lines 0]
set ProjectName [lindex $lines 1]
variable GiDProjectDir
variable GiDProjectName
# GiD_Info Project returns a list with project information { ProblemType ModelName .. .. .. }
if { $ProjectName == "UNNAMED" } {
set GiDProjectName "NONE"
set GiDProjectDir "NONE"
} else {
regsub -all {\\} $ProjectName {/} ProjectName
if { [file extension $ProjectName] == ".gid" } {
set ProjectName [file root $ProjectName]
}
set pos [string last / $ProjectName]
# returns the characters between two points in the string
set GiDProjectName [string range $ProjectName $pos+1 $pos+100]
set GiDProjectDir [string range $ProjectName 0 $pos-1]
append GiDProjectDir "/$GiDProjectName.gid"
}
}
proc OpenSees::GetProjectPath {} {
variable GiDProjectDir
return $GiDProjectDir
}
proc OpenSees::GetProjectName {} {
variable GiDProjectName
return $GiDProjectName
}
# Set/Get OpenSees path
proc OpenSees::SetOpenSeesPath {} {
variable OpenSeesPath
variable OpenSeesProblemTypePath
global InfoWin
set file "$OpenSeesProblemTypePath/OpenSees.path"
set fexists [file exist $file]
if { $fexists == 1 } {
set fp [open $file r]
set file_data [read $fp]
close $fp
set data [split $file_data \n]
set OpenSeesPath [lindex $data 0]
regsub -all {\\} $OpenSeesPath {/} OpenSeesPath
} else {
set response [tk_dialog $InfoWin "Error" "OpenSees.path file was not found. Please re-install GiD+OpenSees interface." error 0 " Ok " ]
destroy $InfoWin
}
}
proc OpenSees::GetOpenSeesPath {} {
variable OpenSeesPath
return $OpenSeesPath
}
# Get OpenSees version
proc OpenSees::GetVersion {} {
variable VersionNumber
return $VersionNumber
}
proc OpenSees::Toolbar1 {{type "DEFAULT INSIDELEFT"}} {
global ToolbarBitmaps1 ToolbarCommands1 ToolbarHelp1 OpenSees1
variable OpenSeesProblemTypePath
global GiDtheme
#
# Toolbar 1 commands
#
proc Opt1_1 { } {
GidOpenMaterials Standard_Uniaxial_Materials
HideInfoBar
}
proc Opt1_2 { } {
GidOpenMaterials Uniaxial_Concrete_Materials
HideInfoBar
}
proc Opt1_3 { } {
GidOpenMaterials Uniaxial_Steel_Materials
HideInfoBar
}
proc Opt1_4 {} {
GidOpenMaterials "Multidimensional_(nD)_Materials"
HideInfoBar
}
proc Opt1_5 { } {
GidOpenMaterials "Section_Force-Deformation"
HideInfoBar
}
proc Opt1_6 { } {
GidOpenMaterials "Combined_Materials"
HideInfoBar
}
proc Opt1_7 { } {
GidOpenMaterials "Records"
HideInfoBar
}
proc Opt1_8 { } {
GidOpenConditions Restraints
HideInfoBar
}
proc Opt1_9 { } {
GidOpenConditions Constraints
HideInfoBar
}
proc Opt1_10 { } {
GidOpenConditions Mass/Damping
HideInfoBar
}
proc Opt1_11 { } {
GidOpenConditions Loads
HideInfoBar
}
proc Opt1_12 { } {
GidOpenConditions Thermocouples
HideInfoBar
}
proc Opt1_13 { } {
GidOpenConditions Debug_conditions
HideInfoBar
}
set ToolbarBitmaps1(0) " \
img/Toolbar/$GiDtheme/btn_Mat_Uni.png \
img/Toolbar/$GiDtheme/btn_Mat_UniC.png \
img/Toolbar/$GiDtheme/btn_Mat_UniS.png \
img/Toolbar/$GiDtheme/btn_Mat_ND.png \
img/Toolbar/$GiDtheme/btn_Mat_Section.png \
img/Toolbar/$GiDtheme/btn_Mat_SeriesParallel.png \
img/Toolbar/$GiDtheme/btn_Separator.png \
img/Toolbar/$GiDtheme/btn_Records.png \
img/Toolbar/$GiDtheme/btn_Restraints.png \
img/Toolbar/$GiDtheme/btn_Constraints.png \
img/Toolbar/$GiDtheme/btn_Mass.png \
img/Toolbar/$GiDtheme/btn_Loads.png \
img/Toolbar/$GiDtheme/btn_Thermo.png \
img/Toolbar/$GiDtheme/btn_Debug.png \
img/Toolbar/$GiDtheme/btn_Separator.png \
img/Toolbar/$GiDtheme/btn_About.png \
"
set ToolbarCommands1(0) [list \
[list -np- OpenSees::Opt1_1] \
[list -np- OpenSees::Opt1_2] \
[list -np- OpenSees::Opt1_3] \
[list -np- OpenSees::Opt1_4] \
[list -np- OpenSees::Opt1_5] \
[list -np- OpenSees::Opt1_6] \
"" \
[list -np- OpenSees::Opt1_7] \
[list -np- OpenSees::Opt1_8] \
[list -np- OpenSees::Opt1_9] \
[list -np- OpenSees::Opt1_10] \
[list -np- OpenSees::Opt1_11] \
[list -np- OpenSees::Opt1_12] \
[list -np- OpenSees::Opt1_13] \
"" \
"-np- VisitWeb http://gidopensees.rclab.civil.auth.gr" \
]
set ToolbarHelp1(0) { \
"Define Standard Unixaxial Materials" \
"Define Concrete Uniaxial Materials" \
"Define Steel Uniaxial Materials" \
"Define Multidimensional Materials" \
"Define Section Force-Deformation" \
"Define Combined Materials" \
"" \
"Records" \
"Assign Restraints" \
"Assign Constraints" \
"Assign Mass/Damping" \
"Assign Loads" \
"Assign thermocouples" \
"Check debug conditions" \
"" \
"GiD+OpenSees Website" \
}
set OpenSees1(toolbarwin) \
[CreateOtherBitmaps PreBar1 "OpenSees Pre-Processor Toolbar 1" \
ToolbarBitmaps1 \
ToolbarCommands1 \
ToolbarHelp1 \
$OpenSeesProblemTypePath \
OpenSees::Toolbar1 $type Pre]
AddNewToolbar "OpenSees 1 Toolbar" WindowGeom1 Toolbar1
}
proc OpenSees::Toolbar2 {{type "DEFAULT INSIDELEFT"}} {
global ToolbarBitmaps2 ToolbarCommands2 ToolbarHelp2 OpenSees2
variable OpenSeesProblemTypePath
global GiDtheme
#
# Toolbar 2 commands
#
proc Opt2_1 { } {
GidOpenConditions ZeroLength_Elements
HideInfoBar
}
proc Opt2_2 { } {
GidOpenMaterials Truss_Elements
HideInfoBar
}
proc Opt2_3 { } {
GidOpenMaterials "Beam-Column_Elements"
HideInfoBar
}
proc Opt2_4 { } {
GidOpenMaterials Surface_Elements
HideInfoBar
}
proc Opt2_5 { } {
GidOpenMaterials Solid_Elements
HideInfoBar
}
proc Opt2_6 { } {
GidOpenProblemData "General_Data"
HideInfoBar
}
proc Opt2_7 { } {
GidOpenProblemData "Options"
HideInfoBar
}
proc Opt2_8 { } {
GiD_Process Mescape Data IDataWindow
HideInfoBar
}
proc Opt2_9 { } {
GiD_Process Mescape Meshing generate
HideInfoBar
}
proc Opt2_10 { } {
Opt1_dialog
}
variable NormalsDrawStatus 0
proc Opt2_11 { } {
variable ElemDrawStatus
variable NormalsDrawStatus
variable ConditionsDrawStatus
switch -- $NormalsDrawStatus {
0 {
GiD_Process Mescape Utilities DrawNormals lines 1:100000
set NormalsDrawStatus 1
set ElemDrawStatus 0
set ConditionsDrawStatus 0
}
1 {
GiD_Process Mescape
set NormalsDrawStatus 0
}
default {}
}
}
variable ElemDrawStatus 0
proc Opt2_12 { } {; # Switch draw elements
variable ElemDrawStatus
variable NormalsDrawStatus
variable ConditionsDrawStatus
switch -- $ElemDrawStatus {
0 {
GiD_Process Mescape
GiD_Process Mescape Data Materials DrawMaterial -DrawAll-
set ElemDrawStatus 1
set ConditionsDrawStatus 0
set NormalsDrawStatus 0
}
1 {
GiD_Process Mescape
set ElemDrawStatus 0
}
default {}
}
}
variable ConditionsDrawStatus 0
proc Opt2_13 { } {; # Switch draw conditions
variable ElemDrawStatus
variable NormalsDrawStatus
variable ConditionsDrawStatus
switch -- $ConditionsDrawStatus {
0 {
GiD_Process Mescape
GiD_Process Mescape Data Conditions DrawCond -DrawAll-
set ConditionsDrawStatus 1
set ElemDrawStatus 0
set NormalsDrawStatus 0
}
1 {
GiD_Process Mescape
set ConditionsDrawStatus 0
}
default {}
}
}
proc Opt2_14 { } {
GiD_Process Mescape Data Intervals ChangeInterval
UpdateInfoBar
}
set ToolbarBitmaps2(0) " \
img/Toolbar/$GiDtheme/btn_Elem_ZeroLength.png \
img/Toolbar/$GiDtheme/btn_Elem_Truss.png \
img/Toolbar/$GiDtheme/btn_Elem_Beam.png \
img/Toolbar/$GiDtheme/btn_Elem_Quad.png \
img/Toolbar/$GiDtheme/btn_Elem_Brick.png \
img/Toolbar/$GiDtheme/btn_Separator.png \
img/Toolbar/$GiDtheme/btn_Data.png \
img/Toolbar/$GiDtheme/btn_Output.png \
img/Toolbar/$GiDtheme/btn_Interval.png \
img/Toolbar/$GiDtheme/btn_Mesh.png \
img/Toolbar/$GiDtheme/btn_Calc.png \
img/Toolbar/$GiDtheme/btn_Separator.png \
img/Toolbar/$GiDtheme/btn_tcl.png \
img/Toolbar/$GiDtheme/btn_Separator.png \
img/Toolbar/$GiDtheme/btn_LocalAxes.png \
img/Toolbar/$GiDtheme/btn_ViewElem.png \
img/Toolbar/$GiDtheme/btn_ViewCond.png \
img/Toolbar/$GiDtheme/btn_ActiveInterval.png \
"
set ToolbarCommands2(0) [list \
[list -np- OpenSees::Opt2_1] \
[list -np- OpenSees::Opt2_2] \
[list -np- OpenSees::Opt2_3] \
[list -np- OpenSees::Opt2_4] \
[list -np- OpenSees::Opt2_5] \
"" \
[list -np- OpenSees::Opt2_6] \
[list -np- OpenSees::Opt2_7] \
[list -np- OpenSees::Opt2_8] \
[list -np- OpenSees::Opt2_9] \
[list -np- OpenSees::Opt2_10] \
"" \
[list -np- mnu_open_tcl] \
"" \
[list -np- OpenSees::Opt2_11] \
[list -np- OpenSees::Opt2_12] \
[list -np- OpenSees::Opt2_13] \
[list -np- OpenSees::Opt2_14] \
]
set ToolbarHelp2(0) { \
"Define Zero Length Elements" \
"Define Truss Elements" \
"Define Beam-Column Elements" \
"Define Surface Elements" \
"Define Solid Elements" \
"" \
"Set General Data" \
"Set Import/Output Options" \
"Set Interval Data" \
"Generate Mesh" \
"Create .tcl, run analysis and postprocess" \
"" \
"Open .tcl file" \
"" \
"Show/Hide Line Local Axes" \
"Show/Hide Elements" \
"Show/Hide All Conditions for Active Interval" \
"Select Active Interval" \
}
set OpenSees2(toolbarwin) \
[CreateOtherBitmaps PreBar2 "OpenSees Pre-Processor Toolbar 2" \
ToolbarBitmaps2 \
ToolbarCommands2 \
ToolbarHelp2 \
$OpenSeesProblemTypePath \
OpenSees::Toolbar2 $type Pre]
AddNewToolbar "OpenSees 2 Toolbar" WindowGeom2 Toolbar2
}
proc OpenSees::Toolbar3 {{type "DEFAULT INSIDELEFT"}} {
global ToolbarBitmaps3 ToolbarCommands3 ToolbarHelp3 OpenSees3
variable OpenSeesProblemTypePath
global GiDtheme
set ToolbarBitmaps3(0) " \
img/Toolbar/$GiDtheme-Macros/btn_EM.png \
img/Toolbar/$GiDtheme-Macros/btn_ES.png \
img/Toolbar/$GiDtheme-Macros/btn_small_X.png \
img/Toolbar/$GiDtheme-Macros/btn_small_Y.png \
img/Toolbar/$GiDtheme-Macros/btn_small_Z.png \
img/Toolbar/$GiDtheme-Macros/btn_small_RX.png \
img/Toolbar/$GiDtheme-Macros/btn_small_RY.png \
img/Toolbar/$GiDtheme-Macros/btn_small_RZ.png \
img/Toolbar/$GiDtheme-Macros/btn_Separator.png \
img/Toolbar/$GiDtheme-Macros/btn_RM.png \
img/Toolbar/$GiDtheme-Macros/btn_RS.png \
img/Toolbar/$GiDtheme-Macros/btn_Separator.png \
img/Toolbar/$GiDtheme-Macros/btn_DM.png \
img/Toolbar/$GiDtheme-Macros/btn_DS.png \
img/Toolbar/$GiDtheme-Macros/btn_Separator.png \
img/Toolbar/$GiDtheme-Macros/btn_ZL.png \
img/Toolbar/$GiDtheme-Macros/btn_small_X.png \
img/Toolbar/$GiDtheme-Macros/btn_small_Y.png \
img/Toolbar/$GiDtheme-Macros/btn_small_Z.png \
img/Toolbar/$GiDtheme-Macros/btn_small_RX.png \
img/Toolbar/$GiDtheme-Macros/btn_small_RY.png \
img/Toolbar/$GiDtheme-Macros/btn_small_RZ.png \
img/Toolbar/$GiDtheme-Macros/btn_Separator.png \
img/Toolbar/$GiDtheme-Macros/btn_M.png \
img/Toolbar/$GiDtheme-Macros/btn_Separator.png \
img/Toolbar/$GiDtheme-Macros/btn_DV.png \
img/Toolbar/$GiDtheme-Macros/btn_L.png \
img/Toolbar/$GiDtheme-Macros/btn_Separator.png \
img/Toolbar/$GiDtheme-Macros/btn_C.png \
"
set ToolbarCommands3(0) [list \
[list -np- GiD_Process Mescape Data Conditions DrawCond Point_Equal_constraint_master_node Equal_constraint_ID] \
[list -np- GiD_Process Mescape Data Conditions DrawCond Point_Equal_constraint_slave_node Equal_constraint_ID] \
[list -np- GiD_Process Mescape Data Conditions DrawCond -ByColor- Point_Equal_constraint_slave_nodes X-Translation] \
[list -np- GiD_Process Mescape Data Conditions DrawCond -ByColor- Point_Equal_constraint_slave_nodes Y-Translation] \
[list -np- GiD_Process Mescape Data Conditions DrawCond -ByColor- Point_Equal_constraint_slave_nodes Z-Translation] \
[list -np- GiD_Process Mescape Data Conditions DrawCond -ByColor- Point_Equal_constraint_slave_nodes X-Rotation] \
[list -np- GiD_Process Mescape Data Conditions DrawCond -ByColor- Point_Equal_constraint_slave_nodes Y-Rotation] \
[list -np- GiD_Process Mescape Data Conditions DrawCond -ByColor- Point_Equal_constraint_slave_nodes Z-Rotation] \
"" \
[list -np- GiD_Process Mescape Data Conditions DrawCond Point_Rigid_link_master_node Rigid_link_ID] \
[list -np- GiD_Process Mescape Data Conditions DrawCond Point_Rigid_link_slave_node Rigid_link_ID] \
"" \
[list -np- GiD_Process Mescape Data Conditions DrawCond Point_Rigid_diaphragm_master_node Rigid_diaphragm_ID] \
[list -np- GiD_Process Mescape Data Conditions DrawCond Point_Rigid diaphragm_slave_node Rigid_diaphragm_ID] \
"" \
[list -np- GiD_Process Mescape Data Conditions DrawCond Point_ZeroLength ZeroLength_ID] \
[list -np- GiD_Process Mescape Data Conditions DrawCond Point_ZeroLength Ux_material] \
[list -np- GiD_Process Mescape Data Conditions DrawCond Point_ZeroLength Uy_material] \
[list -np- GiD_Process Mescape Data Conditions DrawCond Point_ZeroLength Uz_material] \
[list -np- GiD_Process Mescape Data Conditions DrawCond Point_ZeroLength Rx_material] \
[list -np- GiD_Process Mescape Data Conditions DrawCond Point_ZeroLength Ry_material] \
[list -np- GiD_Process Mescape Data Conditions DrawCond Point_ZeroLength Rz_material] \
"" \
[list -np- GiD_Process Mescape Data Conditions DrawCond Point_Mass -draw-] \
"" \
[list -np- GiD_Process Mescape Meshing DrawNumOfDivisions Lines] \
[list -np- GiD_Process Mescape Meshing DrawSizes Lines ] \
"" \
[list -np- GiD_Process Mescape] \
]
set ToolbarHelp3(0) { \
"Equal constraint master node IDs" \
"Equal constraint slave node IDs" \
"Equal constraint slave X state" \
"Equal constraint slave Y state" \
"Equal constraint slave Z state" \
"Equal constraint slave RX state" \
"Equal constraint slave RY state" \
"Equal constraint slave RZ state" \
"" \
"Rigid link master node IDs" \
"Rigid link slave node IDs" \
"" \
"Rigid diaphragm master node IDs" \
"Rigid diaprhagm slave node IDs" \
"" \
"Zerolength elements IDs" \
"ZeroLength Ux material" \
"ZeroLength Uy material" \
"ZeroLength Uz material" \
"ZeroLength Rx material" \
"ZeroLength Ry material" \
"ZeroLength Rz material" \
"" \
"Point masses" \
"" \
"Line mesh divisions" \
"Line mesh sizes" \
"" \
"Clear" \
}
set OpenSees3(toolbarwin) \
[CreateOtherBitmaps PreBar3 "OpenSees Pre-Processor Toolbar 3" \
ToolbarBitmaps3 \
ToolbarCommands3 \
ToolbarHelp3 \
$OpenSeesProblemTypePath \
OpenSees::Toolbar3 $type Pre]
AddNewToolbar "OpenSees 3 Toolbar" WindowGeom3 Toolbar3
}
proc OpenSees::TransformAndClose { } {
global InfoWin
destroy $InfoWin
GiD_Process Mescape data defaults TransfProblem OpenSees
}
set ::InfoWin .gid.transform
proc GetAppDataDir {} {
global env
set platform_comp [string compare "$::tcl_platform(platform)" "windows" ]
if { $platform_comp == 0 } {
package require registry 1.0
set env_home [registry get {HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders} {AppData}]
} else {
set env_home $env(HOME)
}
return $env_home
}
#
# GiD TCL events
#
proc InitGIDProject { dir } {
foreach filename { BeamContact.tcl \
FindMaterialNumber.tcl \
ZeroLength.tcl \
UsedMaterials.tcl \
RigidDiaphragm.tcl \
equalDOF.tcl \
RigidLink.tcl \
Utilities.tcl \
Fibers.tcl \
MultipleDOF.tcl \
Regions.tcl \
UniformExcitation.tcl \
Nodes.tcl} {
source [file join $dir bas tcl $filename]
}
foreach filename { Geometry_func.tcl \
BeamContact.tcl \
EqualDOF.tcl \
Various.tcl \
MinMax.tcl \
Records.tcl \
GenData.tcl \
Damage2p.tcl \
ElasticSection.tcl \
LayeredShell.tcl \
InitStressStrain.tcl \
ElasticBeamColumn.tcl \
Fiber.tcl FiberInt.tcl \
ForceBeamColumn.tcl \
DispBeamColumn.tcl \
DispInteractionBeamColumn.tcl \
PIMY.tcl PDMY.tcl \
IntvData.tcl \
nDmaterials.tcl \
Quad.tcl Shell.tcl \
Truss.tcl \
UniaxialConcrete.tcl \
UniaxialSteel.tcl \
OtherUniaxial.tcl \
ZeroLength.tcl \
SeriesParallel.tcl \
SecAggregator.tcl \
UserMaterial.tcl \
Fire.tcl \
Transform.tcl \
PProcess.tcl \
Dynamics.tcl \
RecordersNS.tcl \
MeshRepair.tcl \
Recorder.tcl} {
source [file join $dir tcl $filename]
}
OpenSees::InitGIDProject $dir
}
proc EndGIDProject {} {
bind .gid <Configure> {}
bind .gid <Activate> {}
bind .gid <Deactivate> {}
bind .gid <Map> {}
if {[winfo exist .ibar]} {destroy .ibar}
EndToolbar1
EndToolbar2
EndToolbar3
}
# check problemtype version mismatch
proc LoadGIDProject { filespd } {
set VersionNumber [OpenSees::GetVersion]
global InfoWin
variable GiDProjectDir
if { [file join {*}[lrange [file split $filespd] end-1 end]] == "OpenSees.gid/OpenSees.spd" } {
# loading the problemtype itself, not a model
} else {
set spd_exist [file exist $filespd]
if {$spd_exist} {
set spd [open $filespd r]
set spd_data [read $spd]
set spd_data [string trim $spd_data]
close $spd
} else {
set spd_data "Unknown"
}
set cmp [string compare "$spd_data" "$VersionNumber"]
if { $cmp != 0 } {
if { [winfo exist .splash]} {
destroy .splash
update
}
if { [info exists ::OpenSees_AskToTransform] && !$::OpenSees_AskToTransform } {
set response 0
} else {
set response [tk_dialog $InfoWin "Version mismatch" "Current problemtype version ($VersionNumber) is different than saved model version ($spd_data). Please transform your model first." info 0 " Transform " " Keep old version " ]
}
if { $response == 0 } {
OpenSees::TransformAndClose
} else {
destroy $InfoWin
}
}
}
}
proc AfterLoadGIDProject { filespd } {
# Project name is set after complete load
OpenSees::SetProjectNameAndPath
}
proc SaveGIDProject { filespd } {
variable OldGiDProjectDir; # current project dir
variable OldGiDProjectName; # current project dir
set OldGiDProjectDir [OpenSees::GetProjectPath]
set OldGiDProjectName [OpenSees::GetProjectName]
set data [GiD_Info Project]
set NewFullPath [lindex $data 1]
regsub -all {\\} $NewFullPath {/} NewFullPath
if { [file extension $NewFullPath] == ".gid" } {
set NewFullPath [file root $NewFullPath]
}
set pos [string last / $NewFullPath]
set NewGiDProjectName [string range $NewFullPath $pos+1 $pos+100]; # New Project Name
set NewGiDProjectDir [string range $NewFullPath 0 $pos-1]; # New project dir
append NewGiDProjectDir "/$NewGiDProjectName.gid"
OpenSees::SetProjectNameAndPath; # Change old project dir to the new one
if { $OldGiDProjectDir != $NewGiDProjectDir} {; # If project names are different
set old_opensees_folder [file join "$OldGiDProjectDir" "OpenSees"]
set records_folder [file join "$OldGiDProjectDir" "Records"]
set scripts_folder [file join "$OldGiDProjectDir" "Scripts"]
set old_tcl_file [file join "$NewGiDProjectDir" "OpenSees" "$OldGiDProjectName.tcl"]
set new_tcl_file [file join "$NewGiDProjectDir" "OpenSees" "$NewGiDProjectName.tcl"]
set old_log_file [file join "$NewGiDProjectDir" "OpenSees" "$OldGiDProjectName.log"]
set new_log_file [file join "$NewGiDProjectDir" "OpenSees" "$NewGiDProjectName.log"]
set old_txt_file [file join "OldGiDProjectDir" "$OldGiDProjectName.txt" ]
set new_txt_file [file join "OldGiDProjectDir" "$NewGiDProjectName.txt" ]
if { [file exists $old_opensees_folder] } {
file copy -force -- $old_opensees_folder $NewGiDProjectDir
if { [file exists $old_tcl_file] } {
file rename -- $old_tcl_file $new_tcl_file
}
if { [file exists $old_log_file] } {
file rename -- $old_log_file $new_log_file
}
}
if { [file exists $records_folder] } {
file copy -force -- $records_folder $NewGiDProjectDir
}
if { [file exists $scripts_folder] } {
file copy -force -- $scripts_folder $NewGiDProjectDir
}
if { [file exists $old_txt_file] } {
file copy -force -- $old_txt_file $new_txt_file
}
}
set VersionNumber [OpenSees::GetVersion]
set spd [open $filespd w]
puts $spd $VersionNumber
close $spd
}
proc BeforeInitGIDPostProcess {} {
# remove bindings
bind .gid <Configure> {}
bind .gid <Activate> {}
bind .gid <Deactivate> {}
bind .gid <Map> {}
if { [winfo exist .ibar]} {
destroy .ibar
}
}
namespace eval TransformZeroLengthData {
variable cond_name "Point_ZeroLength"
variable points ""
variable Ids ""
variable options ""
}