Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by Bachelor22

  1. Hey guys, in order to set up a model, I want the user to choose in which degrees of freedom he wants to constrain his model. Is there a .tcl-command that opens a panel automatically where the user can enter specifications, especially the degrees of freedom, for the constraints? Kind regards, Simon
  2. I modified my code this the way you told me to,, but somehow there's still an error occurring. This is the relevant part of my code: The variable "direction" is created, this is the output in the command window: Do you have an idea what's still wrong? Thanks in advance, Simon
  3. Hey guys, I've created a GUI where the user can choose if he wants to apply a pressure load in x-, y- or z-direction by clicking on a button. By clicking on one of the buttons, a variable called "vector" will be created. This variable should later be used in the command that creates the load. Trying to select this variable with $vector on the position that is marked in yellow in the end of the screenshot, nothing happens. Could you somehow help me out with this problem? Kind regards Simon
  4. Hey guys, I'm trying to customize the setting up of simulation, so I'm using the command *createmarkpanel nodes 1 "Choose the relevant nodes for the constraints." to create the constraints. Later on, I use the same command for creating the load. If, for any reasons, I don't want to use this program for creating the constraints and click on proceed without marking any nodes, an error is occurring and the program stops directly. Thus, it's not possible to use the program to mark the nodes for the load afterwards. Is it possible to somehow avoid this error? Here you can find the relevant part of my script for creating the constraints: *createentity loadcols name=loadcol1 *drawlistresetstyle *setvalue loadcols id=1 name="Lagerung" *startnotehistorystate {Created Constraints} *createmarkpanel nodes 1 "Wählen Sie die Knoten der Lagerung aus." *loadcreateonentity_curve nodes 1 3 1 0 0 0 0 0 0 0 0 0 0 0 *endnotehistorystate {Created Constraints} Kind regards, Simon
  5. Thanks guys, that was exactly the command what I was looking for!
  6. Hey guys, I'm working at a customization problem. During a loop an automesh should be executed when the mesh criterium "aspect ratio" exceeds a specific value. Do you have an idea how I can get access to the aspect ratio values after each iteration? Kind regards Simon
  7. No, not really. I'm trying to customize the process of setting up a model. Before actually marking the entities he's interested in, the user should have the possibility to choose if he wants to bring the load on elements (like it is needed for a pressure) or on nodes (like it is needed for a force). If he wants to mark elements, this part of the code should be active: *createentity loadcols name=loadcol1 *drawlistresetstyle *setvalue loadcols id=2 name="Mechanische Belastung" *createmarkpanel elems 1 "Wählen Sie die Knoten der Belastung aus." set mag_val [hm_getfloat "Belastung =" "Betrag des Pressure (MPa):" 2000] *pressuresonentity_curve elements 1 1 0 1 0 $mag_val 30 1 0 0 0 0 0 If he wants to mark nodes, this part should be active: # *setvalue loadcols id=2 name="Mechanische Belastung" # *startnotehistorystate {Created Force } # *createmarkpanel nodes 1 "Wählen sie die Knoten der Belastung aus." # set mag_val [hm_getfloat "Belastung =" "Betrag der Kraft (N):" 300] # *loadcreateonentity_curve nodes 1 1 1 0 $mag_val 0 0 0 $mag_val 0 0 0 0 0 # *endnotehistorystate {Created Force } I hope this made it a bit clearer. Thanks in advance, Simon
  8. Hey guys, I want to create a .tcl-script, that opens an input mask in HyperMesh where the user can select if he wants to mark elements or nodes (e.g. for force or pressure creation). So by clicking on Nodes he should be able to mark the relevant nodes, by clicking on Elements he should be able to mark the relevant elements. Could you help me out with that problem? Kind regards Simon
  9. Hey tinh, it finally worked out. Thanks for your patience and help. Simon
  10. As you can see on the screenshot, this is the path indicated by windows. I improved my code to: *createstringarray 1 "CONNECTORS_SKIP " hm_answernext yes *feoutputwithdata "C:/Program Files/Altair/2017.2-edu/templates/feoutput/optistruct/optistruct" "C:/Users/Simon/Desktop/CAO/test.fem" 1 0 2 1 1 "C:/Program Files /Altair/2017.2-edu/hwsolvers/scripts/optistruct.bat" "C:/Users/Simon/Desktop/CAO/test.fem" -analysis Now an error is occuring saying that the last line is an invalid command name.
  11. I know where it is located and I'm pretty sure to have chosen the right path. Any other idea why it doesnt work?
  12. Hey tinh, I've checked the other topic, but an error is still occuring. This is the part of my code where I'm trying to run the simulation: *createstringarray 1 "CONNECTORS_SKIP " hm_answernext yes *feoutputwithdata "C:/Program Files/Altair/2017.2-edu/templates/feoutput/optistruct/optistruct" "C:/Users/Simon/Desktop/CAO/test.fem" 1 0 2 1 1 exec "C:/Program Files /Altair/2017.2-edu/hwsolvers/scripts/optistruct.bat" "C:/Users/Simon/Desktop/CAO/test.fem" -analysis *writeh3dwithoptions "C:/Users/Simon/Desktop/CAO/test.h3d" 1 4 The test.fem is written and saved into the desired folder, but an error is occuring in the next line. Could you help me out there? I'm using Windows 10. Besides, I'm aiming for writing a .res-file. Do you know how this works? Kind regards and thanks in advance, Simon
  13. Hey guys, is it somehow possible to start and execute an OptiStruct Solver Run automatically by a .tcl command or script? The aim of this is to create the .h3d-File and .res-File automatically without pressing any buttons. I'm working with the 2017.2 student version of HyperWorks. Kind regards and thanks in advance, Simon
  14. This is the content of the path.txt: C:/Users/Simon/Desktop/Test_1 110 abc.fem
  15. Hey tinh, here is the codes you asked for: set path "" set name "" set temp "" set infor "" set infor [open C:/Users/Simon/Documents/path.txt r] #Startinformationen einlesen while {[gets $infor line]!=-1} { #Variable zeilenweise auslesen incr z #Zeilenzahl if {$z==1} {set path $line} if {$z==2} {set temp $line} if {$z==3} {set name $line} #Informationen der Zeile 1+2 in Variable schreiben } #------------------------------------------------------------------------------------------------------------------------------------- #------------------------------------------------------------------------------------------------------------------------------------- #------------------------------------------------------------------------------------------------------------------------------------- #Programmteil 2: Umrechnung der Knotenspannung set data "" set data [open $path/sample.csv r] #Knotenspannung einlesen while {[gets $data lines] >=0} { #Loop für jede Zeile if {$lines==""} {break} #Wenn Zeile leer ist, abbruch incr i #Loopzähler if {$i>=1} { #Ab Zeile 2 in Variable schreiben set fields [split $lines ","] lassign $fields field1 field2 #Zeile an Komma trennen, die zwei erstellten Werte in Variablen schreiben if {![regexp {N/A} $field2]} { #Wenn in Feld 2 {N/A} steht wird die Zeile nicht in Variable geschrieben if {$field2>=$temp} { #Nur wenn Spannung größer als Referenztemperatur, einschreiben set dif_temp [expr $field2 - $temp] #Temperatur differenz berechnen set a "TEMP" set b 3 #Parameter die zusätzlich eingeschrieben werden set formatStr {%0s%12s%8s%8s} #Zeichenabstand der Variablen definieren (1s = ein Lehrzeichen) append xxx "[format $formatStr $a $b $field1 [format "%.1f" $dif_temp]]\n" #write everything in a variable } } } } close $data #------------------------------------------------------------------------------------------------------------------------------------- #------------------------------------------------------------------------------------------------------------------------------------- #------------------------------------------------------------------------------------------------------------------------------------- #Programmteil 3: Suchen der Einfügezeile in der .fem Datei set fp "" set fp [open $path/$name r] set fem_file [read $fp] close $fp #öffnen der .fem Datei set a 0 set b 0 set e 0 #setze Variablen =0 set daten [split $fem_file "\n"] foreach line_pos $daten { #loop, jede Zeile abfragen if {![regexp {SPC} $line_pos] || ![regexp {1} $line_pos]} {incr a} else {set b $a} if {[regexp {SPC} $line_pos] && [regexp {1} $line_pos]} {incr e} #Logik, für das Finden der individuelle Einfügezeile } set num "" set num [expr $b + $e +1] #Zeilennummer #------------------------------------------------------------------------------------------------------------------------------------- #------------------------------------------------------------------------------------------------------------------------------------- #------------------------------------------------------------------------------------------------------------------------------------- #Programmteil 4: Einschreiben in die .fem Datei set daten "" set daten [open $path/$name r] #öffnen der .fem Datei set y 0 #Setze Variable 0 while {[gets $daten zeile] >=0} { #Loop einlesen incr y #Loopzähler if {$y<=100} { append zzz "$zeile\n" } #.fem Datei bis Zeile 100 in Variable schreiben if {$y==$num} { append zzz "$xxx\n" } #Temperaturen in Variable schreiben if {$y>100} { #.fem Datei ab Zeile 101 in Variable schreiben if {![regexp {TEMP} $zeile] || ![regexp {3} $zeile]} { #wenn bereits Temperaturen in der .fem Datei stehen, diese nicht in die Variable schreiben append zzz "$zeile\n" #einschreiben der .fem Zeilen } } } #------------------------------------------------------------------------------------------------------------------------------------- #------------------------------------------------------------------------------------------------------------------------------------- #------------------------------------------------------------------------------------------------------------------------------------- #Programmteil 5: Outfile erzeugen / Programm schließen set outfile [open $path/$name w] puts $outfile $zzz close $outfile #outfile erzeugen und Variable einfügen catch {unset temp outfile} #zur sicherheit ???????? exit #Programm schließen Kind regards, Simon create_force_constraints.tcl temp_in_fem.tcl
  16. Hey guys, I'm writing a script, where I can set a value (e.g. for the Young's Modulus) for a material property. My problem is that I would like to have a default value in the window, like 210000 MPa, which I can take and proceed or change it if it doesn't suit my material. Is it somehow possible to set such a default value? Kind regards and thanks in advance Simon Attached you can find the part of my script and a screenshot of the window I'm talking about: *startnotehistorystate {Modified E of material} set youngs_modulus [hm_getfloat "Youngs Modulus (Steel)=" "Enter Youngs Modulus:"] *setvalue mats id=1 STATUS=1 1= $youngs_modulus *endnotehistorystate {Modified E of material}
  17. Hey everybody, running the script attached, the following error is occuring: I have absolutely no clue why this is happening. Can you maybe help me out? Kind regards Simon convert_short.tcl
  18. Hey guys, my .tcl-script creates different filetypes and saves all of them into the document folder. In order to not create a mess of files, I want them to be saved in a specific folder. I copied the path of my folder and read it by opening a script, which saves the path into a variable. At the moment, I'm using the following command to create a new file: set f [open path.txt w] How can I save the file into a specific path? Kind regards, Simon
  • Create New...