@@ -73,7 +73,17 @@ def add_femelement_geometry(commtxt, ca_writer):
7373 if len (shelllam_obj .Windall ['elements' ]) > 0 :
7474 print ('*********************OI**********************' )
7575 print ('TODO WINDING STUFF' )
76- #TODO Assign material group first (make function to do this), then layups, then laminate
76+ commtxt += "# WindAll object detected"
77+ for ref in shelllam_obj .References :
78+ #set default layup
79+ layup = {"group" :ref [0 ].Name , "matnames" :matnames , 'thicknesses' :thicknesses , "orientations" :orientations }
80+ layups = [layup ]
81+ for e ,t ,o in zip (shelllam_obj .Windall ['elements' ],shelllam_obj .Windall ['thicknesslists' ],shelllam_obj .Windall ['orientationlists' ]):
82+ layup = {"group" :"E" + str (e ), "thicknesses" :t , "orientations" :o }
83+ layups .append (layup )
84+ commtxt += add_layup (layup ["group" ], layup )
85+ commtxt += add_grps (layups )
86+ commtxt += add_laminate (layups )
7787 else :
7888 for ref in shelllam_obj .References :
7989 #TODO: work out how to create group of all elements and apply to that in case where len(shelllam_obj.References) == 0.
@@ -114,14 +124,22 @@ def add_femelement_geometry(commtxt, ca_writer):
114124 FreeCAD .Console .PrintMessage ("Shell of thickness {}mm added.\n " .format (thickness ))
115125
116126 return commtxt , matname
127+
128+ def add_grps (layups ):
129+ commtxt = "# Adding WindAll groups"
130+ commtxt += "grps = DEFI_GROUP(MAILLAGE=mesh, CREA_GROUP_MA = (\n "
131+ for layup in layups [1 :]:
132+ commtxt += " _F(GROUP_MA = ({},),\n " .format (layups [0 ]["group" ])
133+ commtxt += " NUME_INIT = {},\n " .format (layup ["group" ][1 :])
134+ commtxt += " NUME_FIN = {}\n ," .format (layup ["group" ][1 :])
135+ commtxt += " NOM = '{}'),\n " .format (layup ["group" ])
136+ commtxt += " ))"
117137
118138def add_layup (LUname , layup ):
119139 thicknesses , orientations , matnames = layup ["thicknesses" ], layup ["orientations" ], layup ["matnames" ]
120140 commtxt = "# Composite layup detected, added to shell\n "
121- commtxt += "{} = DEFI_COMPOSITE(COUCHE=(_F(EPAIS={},\n " .format (LUname ,thicknesses [0 ])
122- commtxt += " MATER={},\n " .format (matnames [0 ])
123- commtxt += " ORIENTATION = {}),\n " .format (orientations [0 ])
124- for j in range (1 ,len (thicknesses )):
141+ commtxt += "{} = DEFI_COMPOSITE(COUCHE=(\n " .format (LUname )
142+ for j in range (len (thicknesses )):
125143 commtxt += " _F(EPAIS={},\n " .format (thicknesses [j ])
126144 commtxt += " MATER={},\n " .format (matnames [j ])
127145 commtxt += " ORIENTATION = {}),\n " .format (orientations [j ])
0 commit comments