Python ABAQUS 创建螺旋的代码

Python code for ABAQUS to create helix

我有这段代码是我在网上找到的,它在 ABAQUS 中 运行 时创建了一个螺旋线。我正在尝试理解其背后的逻辑,以便根据我的螺旋线的大小对其进行自定义。

我已经在我理解的代码行上方添加了注释。

#######################
# 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)

有人可以详细说明这背后的逻辑吗?

这段代码创建了一条从点 1 到点 2 的构造 (!!) 线,您的螺旋将围绕这条线构建:

cl = s.ConstructionLine(point1=(0.0, -100.0), point2=(0.0, 100.0))

此代码以定义的间距和圈数围绕构造线旋转草图(矩形):

p.BaseSolidRevolve(sketch=s, angle=numTurns*360.0, flipRevolveDirection=OFF, pitch=pitch, flipPitchDirection=OFF, moveSketchNormalToPath=OFF)