import sketch import part These statements provide access to the objects related to sketches and parts. sketch and part are called Python modules. The next statement in the script is shown in Figure 1. You can read this statement from right to left as follows:
Figure 1. Creating a new model.
mySketch = myModel.ConstrainedSketch(name='Sketch A', sheetSize=200.0) This statement creates a new sketch object named Sketch A in myModel. The variable mySketch is assigned to the new sketch. The sketch will be placed on a sheet 200 units square. Note the following:
xyCoordsInner = ((-5 , 20), (5, 20), (15, 0), (-15, 0), (-5, 20)) xyCoordsOuter = ((-10, 30), (10, 30), (40, -30), (30, -30), (20, -10), (-20, -10), (-30, -30), (-40, -30), (-10, 30)) These two statements define the X- and Y-coordinates of the vertices that form the inner and outer profile of the letter A. The variable xyCoordsInner refers to the vertices of the inner profile, and the variable xyCoordsOuter refers to the vertices of the outer profile. for i in range(len(xyCoordsInner)-1): mySketch.Line(point1=xyCoordsInner[i], point2=xyCoordsInner[i+1]) This loop creates the inner profile of the letter A in mySketch. Four lines are created using the X- and Y-coordinates of the vertices in xyCoordsInner to define the beginning point and the end point of each line. Note the following:
Similarly, a second loop creates the outer profile of the A character. myPart = myModel.Part(name='Part A', dimensionality=THREE_D, type=DEFORMABLE_BODY) This statement creates a three-dimensional, deformable part named Part A in myModel. The new part is assigned to the variable myPart. myPart.BaseSolidExtrude(sketch=mySketch, depth=20.0) This statement creates a base solid extrude feature in myPart by extruding mySketch through a depth of 20.0. myViewport = session.Viewport(name='Viewport for Model A', origin=(20,20), width=150, height=100) This statement creates a new viewport named Viewport for Model A in session. The new viewport is assigned to the variable myViewport. The origin of the viewport is at (20, 20), and it has a width of 150 and a height of 100. myViewport.setValues(displayedObject=myPart) This statement tells Abaqus to display the new part, myPart, in the new viewport, myViewport. myViewport.partDisplayOptions.setValues(renderStyle=SHADED) This statement sets the render style of the part display options in myViewport to shaded. As a result, myPart appears in the shaded render style. |