from py_mentat import * print "This script reads the geometry, creates geometry und apply a general fe mesh" def add_geometry(diameter, wthickness): xs = 0 ys = 0 py_send("*set_curve_type circle_cr") py_send("*add_curves") for i in range(0, 2) : r = diameter / 2 + i * wthickness# radius inside py_send("%f %f 0 %f" % (xs, ys, r)) py_send("*renumber_all") return def add_weldingseam(): fobj = open("weldingseam.txt") for line in fobj: py_send("*add_points") #print line.rstrip() line = line.rstrip() parts = line.split() x = float(parts[0]) y = float(parts[1]) z = float(parts[2]) py_send("%f %f %f" % (x, y, z)) fobj.close() return def add_polylineweld(): py_send("*set_curve_type polyline") #curve type py_send("*add_curves") for i in range(17, 104) : pt = i py_send("%i" % (pt)) return def main(): diameter = py_get_float("diameter") wthickness = py_get_float("wthickness") add_geometry(diameter, wthickness) add_weldingseam() add_polylineweld() return if __name__ == '__main__': py_connect("",40007) main() py_disconnect()