# ANSYS WB二次开发专栏文章索引

SpaceCliam实体对象的生成方式有很多种，本文讲解如何通过拉伸进行。

### 面的拉伸

ClearAll()

#创建工作平面

myplane=Plane.PlaneXY

ss=ViewHelper.SetSketchPlane(myplane)

#平面矩形的创建

BB=100

HH=50

P1=Point2D.Create(0,0)

P2=Point2D.Create(MM(BB),0)

P3=Point2D.Create(MM(BB),MM(HH))

Re=SketchRectangle.Create(P1,P2,P3)

P4=Point2D.Create(MM(BB*2),0)

P5=Point2D.Create(MM(BB*2),MM(HH*4))

Re=SketchLine.Create(P4,P5)

Re=InteractionMode.Solid

Re=ViewHelper.SetViewMode(Re)

sectionPlane = Plane.Create(Frame.Create(Point.Create(MM(-20), MM(0), MM(0)), Direction.DirY, Direction.DirZ))

#激活当前草图，绘制另外一个矩形

result = ViewHelper.SetSketchPlane(sectionPlane, None)

BB=100

HH=50

P1=Point2D.Create(0,0)

P2=Point2D.Create(MM(BB),0)

P3=Point2D.Create(MM(BB),MM(HH))

Re=SketchRectangle.Create(P1,P2,P3)

Re=InteractionMode.Solid

Re=ViewHelper.SetViewMode(Re)

#三维线的绘制

Re = Sketch3D.Set3DSketchMode(True)

# EndBlock

# Sketch Point

point1 = Point.Create(MM(BB), MM(HH), MM(HH))

point2= Point.Create(MM(0.5*BB), MM(HH*0.5), MM(2*HH))

result = SketchLine.Create(point1, point2)

Re=InteractionMode.Solid

#拉伸的控制

Sel=FaceSelection.Create(GetRootPart().Bodies[0].Faces[0])

options = ExtrudeFaceOptions()

result = ExtrudeFaces.Execute(Sel, MM(40.96), options)

### 线的拉伸

# Create Origin

origin = Point.Create(MM(20.96), MM(50), MM(25))

x_Direction = Direction.DirY

y_Direction = Direction.DirZ

result = DatumOriginCreator.Create(origin, x_Direction, y_Direction, None)

# EndBlock

secondarySelection=Selection.Create(GetRootPart().CoordinateSystems[0].Axes[0])

# Extrude 1 Edge

selection = Selection.Create(GetRootPart().Curves[0])

options = ExtrudeEdgeOptions()

result = ExtrudeEdges.Execute(selection, secondarySelection, MM(24.55), options)

# EndBlock