Erikka
Geotechnical
- Dec 10, 2009
- 7
Hi everyone,
I’m trying to write a python script to build a solid using the method SolidLoft(). The solid should be created by lofting between three sections (three closed loops of edges). Each section lies on a plane parallel to the xy plane (three different z) and it is made of a spline and a polyline.
I’m brand new to python and what I’ve done for now includes three lines of script to create the Splines plus three lines to create the Polylines, selecting the points with same z from txt files (x,y,z):
Splines:
mdb.models['importDPxyz'].parts['DPxyz'].WireSpline(points=(sorted([elem for elem in myPointsListS if elem[2] == 8],key=itemgetter(1))))
mdb.models['importDPxyz'].parts['DPxyz'].WireSpline(points=(sorted([elem for elem in myPointsListS if elem[2] == 4],key=itemgetter(1))))
mdb.models['importDPxyz'].parts['DPxyz'].WireSpline(points=(sorted([elem for elem in myPointsListS if elem[2] == 0],key=itemgetter(1))))
polylines:
mdb.models['importDPxyz'].parts['DPxyz'].WirePolyLine(points=([elem for elem in myPointsListPL if elem[2] == 8]))
mdb.models['importDPxyz'].parts['DPxyz'].WirePolyLine(points=([elem for elem in myPointsListPL if elem[2] == 4]))
mdb.models['importDPxyz'].parts['DPxyz'].WirePolyLine(points=([elem for elem in myPointsListPL if elem[2] == 0]))
How can I create the sequence of the edges that lies on a plane (i.e. z=0)? All the edges created in the same plane are a close loop, so they are the a good section for the creation of the solid loft.
I would like to create a loop to speed up the creation of many splines picking the points with different z from a bigger txt file (every z+1). I can copy and paste the same line, changing the z value, as I already did, but I think it is quite time consuming and quite stupid.
Thanks in advance,
Erika
I’m trying to write a python script to build a solid using the method SolidLoft(). The solid should be created by lofting between three sections (three closed loops of edges). Each section lies on a plane parallel to the xy plane (three different z) and it is made of a spline and a polyline.
I’m brand new to python and what I’ve done for now includes three lines of script to create the Splines plus three lines to create the Polylines, selecting the points with same z from txt files (x,y,z):
Splines:
mdb.models['importDPxyz'].parts['DPxyz'].WireSpline(points=(sorted([elem for elem in myPointsListS if elem[2] == 8],key=itemgetter(1))))
mdb.models['importDPxyz'].parts['DPxyz'].WireSpline(points=(sorted([elem for elem in myPointsListS if elem[2] == 4],key=itemgetter(1))))
mdb.models['importDPxyz'].parts['DPxyz'].WireSpline(points=(sorted([elem for elem in myPointsListS if elem[2] == 0],key=itemgetter(1))))
polylines:
mdb.models['importDPxyz'].parts['DPxyz'].WirePolyLine(points=([elem for elem in myPointsListPL if elem[2] == 8]))
mdb.models['importDPxyz'].parts['DPxyz'].WirePolyLine(points=([elem for elem in myPointsListPL if elem[2] == 4]))
mdb.models['importDPxyz'].parts['DPxyz'].WirePolyLine(points=([elem for elem in myPointsListPL if elem[2] == 0]))
How can I create the sequence of the edges that lies on a plane (i.e. z=0)? All the edges created in the same plane are a close loop, so they are the a good section for the creation of the solid loft.
I would like to create a loop to speed up the creation of many splines picking the points with different z from a bigger txt file (every z+1). I can copy and paste the same line, changing the z value, as I already did, but I think it is quite time consuming and quite stupid.
Thanks in advance,
Erika