Model.morphloadshape#
- Model.morphloadshape(filename, apply_shapes, filetype, create_elems, tolerance)#
A shape stored as either grid perturbations (
filetype=0) or as a local shape (filetype=1) is read in to and optionally applied to the model.filetype=1gives you the option of reading the local shapes into as elements with the shapes acting on those elements. Your can then useModel.morphtranslateshapemark(),Model.morphpositionshapemark(), orModel.morphreflectshapemark()to apply the shape to the rest of the model.filetype=1requires a value for tolerance, the envelope for shapes to be applied to the model if the apply flag is on.- Parameters:
filename (hwString) – Full name and path of the file containing the shapes.
apply_shapes (int) –
0 - Do not apply shapes to model
1 - Apply shapes to model
filetype (int) –
0 - OptiStruct/Radioss .fem or .grid format, or
Model.morphsaveshape()“as grids”1 -
Model.morphsaveshape()“as shapes”create_elems (int) –
0 - Do not re-create elements from file (
filetype=1only)1 - Recreate elements from file (
filetype=1only)tolerance (double) – Envelope for application of local shapes. The envelope is the range of influence that an imported shape will have on the new mesh. Since the original mesh (where the shape was when the shape file was saved) and target mesh may not match exactly, the envelope must be large enough to include nodes that may lie outside the bounds of the original mesh were it to be positioned on to the target mesh. Nodes inside the envelope will be perturbed proportional to how close they are to the bounds of the original mesh. Set the tolerance to -1.0 to use the default value, which is equal to the average length of the sides of the elements in the shape. Type in a larger value to capture more nodes within the envelope. Similarly, if too many nodes are being affected, try using a smaller envelope. You may also use a very large envelope (a million times the size of an average element) to make sure that the shape is applied to nearby nodes at full value.
Example#
Load and apply the shapes found in file “C:/Temp/save.shp” in file format 1 using the default tolerance#import hm import hm.entities as ent model = hm.Model() model.morphloadshape( filename="C:/Temp/save.shp", apply_shapes=1, filetype=1, create_elems=0, tolerance=-1, )