Я пишу сценарий для запуска в Abaqus. Я хочу создать куб (1 * 1 * 1). Затем я хочу создать 63 пустоты в кубе. У меня есть координаты центра всех сфер, а также радиус. как в CSV-файле, так и в python коде. У меня проблема с определением координат. Я хочу создать пористую solid. Вот мой код Вы можете помочь мне? Большое вам спасибо.
# -*- coding: mbcs -*-
from part import *
from material import *
from section import *
from assembly import *
from step import *
from interaction import *
from load import *
from mesh import *
from optimization import *
from job import *
from sketch import *
from visualization import *
from connectorBehavior import *
import numpy as np
from coordinates import Coordinate.from_sequence *
############################################
# defining data (Units: meter and Newton)
L = 1 # lengh of cube
cricle_radius = 0.1407
ball = 63
num_ball = 63# max ball
############################################
mdb.models['Model-1'].ConstrainedSketch(name='__profile__', sheetSize=0.5)
mdb.models['Model-1'].sketches['__profile__'].rectangle(point1=(0.0, 0.0),
point2=(0.04, 0.05))
mdb.models['Model-1'].sketches['__profile__'].ObliqueDimension(textPoint=(
-0.0247507989406586, 0.0196989551186562), value=L, vertex1=
mdb.models['Model-1'].sketches['__profile__'].vertices[0], vertex2=
mdb.models['Model-1'].sketches['__profile__'].vertices[1])
mdb.models['Model-1'].sketches['__profile__'].ObliqueDimension(textPoint=(
0.0256675183773041, 0.0636780187487602), value=L, vertex1=
mdb.models['Model-1'].sketches['__profile__'].vertices[1], vertex2=
mdb.models['Model-1'].sketches['__profile__'].vertices[2])
mdb.models['Model-1'].Part(dimensionality=THREE_D, name='Part-1', type=
DEFORMABLE_BODY)
mdb.models['Model-1'].parts['Part-1'].BaseSolidExtrude(depth=L, sketch=
mdb.models['Model-1'].sketches['__profile__'])
del mdb.models['Model-1'].sketches['__profile__']
mdb.models['Model-1'].ConstrainedSketch(name='__profile__', sheetSize=0.5)
mdb.models['Model-1'].sketches['__profile__'].ConstructionLine(point1=(0.0,
-0.25), point2=(0.0, 0.25))
mdb.models['Model-1'].sketches['__profile__'].FixedConstraint(entity=
mdb.models['Model-1'].sketches['__profile__'].geometry[2])
mdb.models['Model-1'].sketches['__profile__'].ArcByCenterEnds(center=(0.0, 0.0)
, direction=COUNTERCLOCKWISE, point1=(0.0, -0.04), point2=(0.0, 0.04))
mdb.models['Model-1'].sketches['__profile__'].CoincidentConstraint(
addUndoState=False, entity1=
mdb.models['Model-1'].sketches['__profile__'].vertices[2], entity2=
mdb.models['Model-1'].sketches['__profile__'].geometry[2])
mdb.models['Model-1'].sketches['__profile__'].CoincidentConstraint(
addUndoState=False, entity1=
mdb.models['Model-1'].sketches['__profile__'].vertices[0], entity2=
mdb.models['Model-1'].sketches['__profile__'].geometry[2])
mdb.models['Model-1'].sketches['__profile__'].CoincidentConstraint(
addUndoState=False, entity1=
mdb.models['Model-1'].sketches['__profile__'].vertices[1], entity2=
mdb.models['Model-1'].sketches['__profile__'].geometry[2])
mdb.models['Model-1'].sketches['__profile__'].RadialDimension(curve=
mdb.models['Model-1'].sketches['__profile__'].geometry[3], radius= cricle_radius,
textPoint=(0.0178755968809128, 0.0190117806196213))
mdb.models['Model-1'].sketches['__profile__'].Line(point1=(0.0, cricle_radius), point2=(
0.0, -cricle_radius))
mdb.models['Model-1'].sketches['__profile__'].VerticalConstraint(addUndoState=
False, entity=mdb.models['Model-1'].sketches['__profile__'].geometry[4])
mdb.models['Model-1'].sketches['__profile__'].PerpendicularConstraint(
addUndoState=False, entity1=
mdb.models['Model-1'].sketches['__profile__'].geometry[3], entity2=
mdb.models['Model-1'].sketches['__profile__'].geometry[4])
mdb.models['Model-1'].Part(dimensionality=THREE_D, name='sphere', type=
DEFORMABLE_BODY)
mdb.models['Model-1'].parts['sphere'].BaseSolidRevolve(angle=360.0,
flipRevolveDirection=OFF, sketch=
mdb.models['Model-1'].sketches['__profile__'])
del mdb.models['Model-1'].sketches['__profile__']
mdb.models['Model-1'].Material(name='Material-1')
mdb.models['Model-1'].materials['Material-1'].Elastic(table=((200000000000.0,
0.3), ))
mdb.models['Model-1'].HomogeneousSolidSection(material='Material-1', name=
'Section-1', thickness=None)
mdb.models['Model-1'].parts['Part-1'].Set(cells=
mdb.models['Model-1'].parts['Part-1'].cells.getSequenceFromMask(('[#1 ]',
), ), name='Set-1')
mdb.models['Model-1'].parts['Part-1'].SectionAssignment(offset=0.0,
offsetField='', offsetType=MIDDLE_SURFACE, region=
mdb.models['Model-1'].parts['Part-1'].sets['Set-1'], sectionName=
'Section-1', thicknessAssignment=FROM_SECTION)
mdb.models['Model-1'].rootAssembly.DatumCsysByDefault(CARTESIAN)
mdb.models['Model-1'].rootAssembly.Instance(dependent=ON, name='Part-1-1',
part=mdb.models['Model-1'].parts['Part-1'])
mdb.models['Model-1'].rootAssembly.translate(instanceList=('Part-1-1', ),
vector=(0.0, 0.15, 0.0))
mdb.models['Model-1'].rootAssembly.translate(instanceList=('Part-1-1', ),
vector=(0.0, 0.8, 0.0))
######################################################
############### Algorithm #########################
coords = Coordinate.from_sequence([Coordinates of centers like (x,y,z) should be write here], order='xyz')
coords = np.resize(coords,(63,3))
######################################################
for x in range(1,ball):
mdb.models['Model-1'].rootAssembly.Instance(dependent=ON, name='sphere-'+str(x),
part=mdb.models['Model-1'].parts['sphere'])
mdb.models['Model-1'].rootAssembly.instances['sphere-'+str(x)].translate(vector=(
0, 0.0, 0.0))
mdb.models['Model-1'].rootAssembly.translate(instanceList=('sphere-'+str(x), ),
vector=(coords[x][0], coords[x][1], coords[x][2]))
mdb.models['Model-1'].rootAssembly.InstanceFromBooleanCut(cuttingInstances=(
mdb.models['Model-1'].rootAssembly.instances['sphere-1'],
mdb.models['Model-1'].rootAssembly.instances['sphere-2'],
mdb.models['Model-1'].rootAssembly.instances['sphere-3'],
mdb.models['Model-1'].rootAssembly.instances['sphere-4'],
mdb.models['Model-1'].rootAssembly.instances['sphere-5'],
mdb.models['Model-1'].rootAssembly.instances['sphere-6'],
mdb.models['Model-1'].rootAssembly.instances['sphere-7'],
mdb.models['Model-1'].rootAssembly.instances['sphere-8'],
mdb.models['Model-1'].rootAssembly.instances['sphere-9'],
mdb.models['Model-1'].rootAssembly.instances['sphere-10'],
mdb.models['Model-1'].rootAssembly.instances['sphere-11'],
mdb.models['Model-1'].rootAssembly.instances['sphere-12'],
mdb.models['Model-1'].rootAssembly.instances['sphere-13'],
mdb.models['Model-1'].rootAssembly.instances['sphere-14'],
mdb.models['Model-1'].rootAssembly.instances['sphere-15'],
mdb.models['Model-1'].rootAssembly.instances['sphere-16'],
mdb.models['Model-1'].rootAssembly.instances['sphere-17'],
mdb.models['Model-1'].rootAssembly.instances['sphere-18'],
mdb.models['Model-1'].rootAssembly.instances['sphere-19'],
mdb.models['Model-1'].rootAssembly.instances['sphere-20'],
mdb.models['Model-1'].rootAssembly.instances['sphere-21'],
mdb.models['Model-1'].rootAssembly.instances['sphere-22'],
mdb.models['Model-1'].rootAssembly.instances['sphere-23'],
mdb.models['Model-1'].rootAssembly.instances['sphere-24'],
mdb.models['Model-1'].rootAssembly.instances['sphere-25'],
mdb.models['Model-1'].rootAssembly.instances['sphere-26'],
mdb.models['Model-1'].rootAssembly.instances['sphere-27'],
mdb.models['Model-1'].rootAssembly.instances['sphere-28'],
mdb.models['Model-1'].rootAssembly.instances['sphere-29'],
mdb.models['Model-1'].rootAssembly.instances['sphere-30'],
mdb.models['Model-1'].rootAssembly.instances['sphere-31'],
mdb.models['Model-1'].rootAssembly.instances['sphere-32'],
mdb.models['Model-1'].rootAssembly.instances['sphere-33'],
mdb.models['Model-1'].rootAssembly.instances['sphere-34'],
mdb.models['Model-1'].rootAssembly.instances['sphere-35'],
mdb.models['Model-1'].rootAssembly.instances['sphere-36'],
mdb.models['Model-1'].rootAssembly.instances['sphere-37'],
mdb.models['Model-1'].rootAssembly.instances['sphere-38'],
mdb.models['Model-1'].rootAssembly.instances['sphere-39'],
mdb.models['Model-1'].rootAssembly.instances['sphere-40'],
mdb.models['Model-1'].rootAssembly.instances['sphere-41'],
mdb.models['Model-1'].rootAssembly.instances['sphere-42'],
mdb.models['Model-1'].rootAssembly.instances['sphere-43'],
mdb.models['Model-1'].rootAssembly.instances['sphere-44'],
mdb.models['Model-1'].rootAssembly.instances['sphere-45'],
mdb.models['Model-1'].rootAssembly.instances['sphere-46'],
mdb.models['Model-1'].rootAssembly.instances['sphere-47'],
mdb.models['Model-1'].rootAssembly.instances['sphere-48'],
mdb.models['Model-1'].rootAssembly.instances['sphere-49'],
mdb.models['Model-1'].rootAssembly.instances['sphere-50'],
mdb.models['Model-1'].rootAssembly.instances['sphere-51'],
mdb.models['Model-1'].rootAssembly.instances['sphere-52'],
mdb.models['Model-1'].rootAssembly.instances['sphere-53'],
mdb.models['Model-1'].rootAssembly.instances['sphere-54'],
mdb.models['Model-1'].rootAssembly.instances['sphere-55'],
mdb.models['Model-1'].rootAssembly.instances['sphere-56'],
mdb.models['Model-1'].rootAssembly.instances['sphere-57'],
mdb.models['Model-1'].rootAssembly.instances['sphere-58'],
mdb.models['Model-1'].rootAssembly.instances['sphere-59'],
mdb.models['Model-1'].rootAssembly.instances['sphere-60'],
mdb.models['Model-1'].rootAssembly.instances['sphere-61'],
mdb.models['Model-1'].rootAssembly.instances['sphere-62']),
instanceToBeCut=mdb.models['Model-1'].rootAssembly.instances['Part-1-1'], name='Part-2',
originalInstances=DELETE)
mdb.models['Model-1'].parts['Part-2'].setMeshControls(elemShape=TET, regions=
mdb.models['Model-1'].parts['Part-2'].cells.getSequenceFromMask(('[#1 ]',
), ), technique=FREE)
mdb.models['Model-1'].parts['Part-2'].setElementType(elemTypes=(ElemType(
elemCode=C3D20R, elemLibrary=STANDARD), ElemType(elemCode=C3D15,
elemLibrary=STANDARD), ElemType(elemCode=C3D10, elemLibrary=STANDARD)),
regions=(mdb.models['Model-1'].parts['Part-2'].cells.getSequenceFromMask((
'[#1 ]', ), ), ))
mdb.models['Model-1'].parts['Part-2'].seedPart(deviationFactor=0.1,
minSizeFactor=0.1, size=0.1)
mdb.models['Model-1'].parts['Part-2'].generateMesh()
mdb.models['Model-1'].rootAssembly.regenerate()
mdb.models['Model-1'].StaticStep(initialInc=0.2, name='Step-1', previous=
'Initial')
mdb.models['Model-1'].rootAssembly.Set(faces=
mdb.models['Model-1'].rootAssembly.instances['Part-2-1'].faces.getSequenceFromMask(
('[#8 ]', ), ), name='Set-1')
mdb.models['Model-1'].EncastreBC(createStepName='Step-1', localCsys=None, name=
'BC-1', region=mdb.models['Model-1'].rootAssembly.sets['Set-1'])
mdb.models['Model-1'].rootAssembly.Surface(name='Surf-1', side1Faces=
mdb.models['Model-1'].rootAssembly.instances['Part-2-1'].faces.getSequenceFromMask(
('[#2 ]', ), ))
mdb.models['Model-1'].Pressure(amplitude=UNSET, createStepName='Step-1',
distributionType=UNIFORM, field='', magnitude=10000.0, name='Load-1',
region=mdb.models['Model-1'].rootAssembly.surfaces['Surf-1'])