Skip to content

Commit 6c4055d

Browse files
committed
Merge remote-tracking branch 'origin/zzqbranch'
2 parents d80f860 + 689cbde commit 6c4055d

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

src/ansys/dyna/core/pre/dynabase.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2525,6 +2525,66 @@ def create(self):
25252525
logging.info("Cylinder Rigidwall Created...")
25262526

25272527

2528+
class RigidwallSphere:
2529+
"""Defines a rigid wall with a sphere form.
2530+
2531+
Parameters
2532+
----------
2533+
center : Point, optional
2534+
The center of sphere.
2535+
The default is ``(0, 0, 0)``.
2536+
orient : Point, optional
2537+
Vector n determines the orintation of the rigidwall,the center define the tail of normal n,
2538+
the orient define the head of normal n.
2539+
The default is ``(0, 0, 0)``.
2540+
radius : float, optional
2541+
Radius of the sphere. The default is ``1``.
2542+
"""
2543+
2544+
def __init__(self, center=Point(0, 0, 0), orient=Point(0, 0, 0), radius=1):
2545+
self.stub = DynaBase.get_stub()
2546+
self.center = center
2547+
self.orient = orient
2548+
self.radius = radius
2549+
self.motion = -1
2550+
self.lcid = 0
2551+
self.dir = Direction(1, 0, 0)
2552+
2553+
def set_motion(self, curve, motion=Motion.VELOCITY, dir=Direction(1, 0, 0)):
2554+
"""Set the prescribed motion."""
2555+
curve.create(self.stub)
2556+
self.lcid = curve.id
2557+
self.motion = motion.value
2558+
if self.motion == Motion.DISPLACEMENT:
2559+
self.motion = 1
2560+
self.dir = dir
2561+
2562+
def create(self):
2563+
"""Create a rigidwall sphere."""
2564+
parameter = [
2565+
self.center.x,
2566+
self.center.y,
2567+
self.center.z,
2568+
self.orient.x,
2569+
self.orient.y,
2570+
self.orient.z,
2571+
self.radius,
2572+
]
2573+
self.stub.CreateRigidWallGeom(
2574+
RigidWallGeomRequest(
2575+
geomtype=4,
2576+
motion=self.motion,
2577+
display=1,
2578+
parameter=parameter,
2579+
lcid=self.lcid,
2580+
vx=self.dir.x,
2581+
vy=self.dir.y,
2582+
vz=self.dir.z,
2583+
)
2584+
)
2585+
logging.info("Sphere Rigidwall Created...")
2586+
2587+
25282588
class RigidwallPlanar:
25292589
"""Defines planar rigid walls with either finite or infinite size.
25302590

0 commit comments

Comments
 (0)