import pyck domain = [10.0, 10.0, 10.0] h = 0.02 smoothingKernelFunc = 2 speedsound = 1 density = 1 shearmodulus = 1 bulkmodulus = 1 # Create a packer, see packers directory for options cubic = pyck.CubicPacker([10.0, 10.0, 10.0], h) # pack = pyck.Pack(cubic); # do not create the cubic packer in this # function call as it will be destroyed, blame SWIG developers pack = pyck.StructuredPack(cubic) # Create some shapes, see shapes directory for options and reference # First argument is always a tag for these particles # Mapping operations are applied sequentially tri = pyck.TriPrism(1, [1.5, 3.0, 0.0], [3, 0, 0], [0, 0, 0], 2) # Map the shapes and generate the pack # pack.AddShape(cube); # As with creating the cubic packer, do not create the shapes within the function call here # pack.AddShape(sphere); pack.AddShape(tri) pack.Process() # Create a new model from the pack model = pyck.Model(pack) # Create a new field of n-dimensional integers # Arguments are CreateIntField(label,dimensions)
import pyck domain = [100.0, 100.0, 500.0] h = domain[0] / 100 smoothingKernelFunc = 2 speedsound = 1 density = 1 shearmodulus = 1 bulkmodulus = 1 # Create a packer, see packers directory for options Hcp = pyck.HcpPacker(domain, h) pack = pyck.StructuredPack(Hcp) tibia_min = [154.2328, 204.0634, -853.9525] # Read from the tibia STL file tibia_max = [226.9384, 268.8318, -468.3400] tibia_len = [ tibia_max[0] - tibia_min[0], tibia_max[1] - tibia_min[1], tibia_max[2] - tibia_min[2] ] tibia_center = [ tibia_min[0] + tibia_len[0] / 2, tibia_min[1] + tibia_len[1] / 2, tibia_min[2] + tibia_len[2] / 2 ] tibia_scale = 1 tibia_len[0] = tibia_len[0] * tibia_scale tibia_len[1] = tibia_len[1] * tibia_scale tibia_len[2] = tibia_len[2] * tibia_scale tibia_dcenter = [domain[0] / 2, domain[1] / 2, domain[2] / 2] tibia_translation = [ tibia_dcenter[0] - tibia_center[0], tibia_dcenter[1] - tibia_center[1],