[英]Python code for ABAQUS to create helix
I have this code I have found online that creates a helix when run in ABAQUS. 我有在网上找到的这段代码,当在ABAQUS中运行时会创建一个螺旋。 I am trying to understand the logic behind it to perhaps customize it to the size of my helix.
我正在尝试了解其背后的逻辑,以便根据其螺旋线的大小对其进行自定义。
I have added comments above the line of codes I understand. 我在我理解的代码行上方添加了注释。
#######################
# Imports controls from abaqus
from abaqus import *
from abaqusConstants import *
# Defining helix dimensions
width = 20.0
height = 0.05
origin = (15.0, 0.0)
pitch = 50.0
numTurns = 1.0
# Creating sketch in abaqus under name 'rect' and sheetsize of 200
s = mdb.models['Model-1'].ConstrainedSketch(name='rect', sheetSize=200.0)
# No idea. What does .geometry return?
g = s.geometry
# No idea
s.setPrimaryObject(option=STANDALONE)
# Creating a line from point1 to point2, why not use .Line?
cl = s.ConstructionLine(point1=(0.0, -100.0), point2=(0.0, 100.0))
# No idea as I don't know what is stored in g (adding constraints but where?
s.FixedConstraint(entity=g[2])
s.FixedConstraint(entity=g[cl.id])
# Creating rectangle from point1 to point2
s.rectangle(point1=(origin[0], origin[1]), point2=(origin[0]+width, origin[1]+height))
# Creating Part-1 3D Deformable
p = mdb.models['Model-1'].Part(name='Part-1', dimensionality=THREE_D,
type=DEFORMABLE_BODY)
p = mdb.models['Model-1'].parts['Part-1']
p.BaseSolidRevolve(sketch=s, angle=numTurns*360.0, flipRevolveDirection=OFF,
pitch=pitch, flipPitchDirection=OFF, moveSketchNormalToPath=OFF)
#In above command try changing the following member: moveSketchNormalToPath=ON
s.unsetPrimaryObject()
session.viewports['Viewport: 1'].setValues(displayedObject=p)
Could someone elaborate the logic behind this? 有人可以详细说明其背后的逻辑吗?
This code creates a Construction(!!) line from point1 to point2, around this line your helix will construct: 这段代码创建了从point1到point2的Construction(!!)行,您的螺旋将围绕此行构造:
cl = s.ConstructionLine(point1=(0.0, -100.0), point2=(0.0, 100.0))
This code revolves your sketch(rectange) around your construction line with defined pitch and number of turns: 此代码以定义的螺距和匝数围绕构造线旋转草图(矩形):
p.BaseSolidRevolve(sketch=s, angle=numTurns*360.0, flipRevolveDirection=OFF, pitch=pitch, flipPitchDirection=OFF, moveSketchNormalToPath=OFF)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.