ich habe eine Platte in Marc entworfen und appliziere einen Top Load.
Nun moechte ich die Werte fuer Displacement Y haben fuer die Nodes auf dem oberen surface und in einer Liste ausgeben.
Ich habe erst vor kurzem mit Python und Marc begonnen also bitte nicht zereissen, wenn vllt gravierende Fehler im Code bestehen
Es erfolgt keine Ausgabe (bis auf mein Test-"Hallo").
Mein Code sieht folgendermassen aus.
f
Code: Alles auswählen
rom py_mentat import *
def check_tol(f1, f2, tol):
if f1 == f2:
return 1
if f1 + tol < f2:
if f1 - tol > f2:
return 1
return 0
def main():
py_send("*post_close")
py_send("*post_open plate_model_job1.t16")
py_send("*post_next")
py_send("*post_value Displacement Y")
py_send("*post_numerics")
print "Hallo"
n = py_get_int("nnodes()") #get all nodes
print n
nodes_list = []
for i in range(1,n+1): #for-loop to get the nodes at the top surface
str = "node_y(%d)" % i
f = py_get_float(str)
if check_tol(f, 10, .001):
nodes_list.append[i]
values = []
print nodes_list #list for the displacements in y-direction
for i in range(0,len(nodes_list)):
str = "node_id(%i)" % nodes_list[i]
n_id = py_get_int(str)
dis_y = "displace_y(%f)" % n_id #get displacement
f= py_get_float(dis_y)
values[i] = f #create list with all the values
print values
for i in range(0,len(values)):
str = "%i %f" % (nodes_list[i], values[i])
print str
return