A.4 Cargo crane

gsi_crane_caemodel.py

#
# Getting Started with ABAQUS
#
# Script for static crane example
#

import string
def GetBlockPosition(modelName, blockPrefix):
    if blockPrefix == '':
        return len(mdb.models[modelName].keywordBlock.sieBlocks)-1
    pos = 0
    for block in mdb.models[modelName].keywordBlock.sieBlocks:
        if string.lower(block[0:len(blockPrefix)])==string.lower(blockPrefix):
            return pos
        pos=pos+1
    return -1

from abaqus import *
from abaqusConstants import *
session.Viewport(name='Viewport: 1', origin=(0.0, 0.0), width=276.171875, 
    height=190.625)
session.viewports['Viewport: 1'].makeCurrent()
session.viewports['Viewport: 1'].maximize()
from caeModules import *
from driverUtils import executeOnCaeStartup
executeOnCaeStartup()
Mdb()
session.viewports['Viewport: 1'].setValues(displayedObject=None)
##
##  Sketch profile of truss
##
p = mdb.models['Model-1'].Part(name='Truss', dimensionality=THREE_D, 
    type=DEFORMABLE_BODY)
p.ReferencePoint(point=(0.0, 0.0, 0.0))
session.viewports['Viewport: 1'].setValues(displayedObject=p)
r = p.referencePoints
p.DatumPointByOffset(point=r[1], vector=(0.0, 1.0, 0.0))
p.DatumPointByOffset(point=r[1], vector=(8.0, 1.5, 0.9))
session.viewports['Viewport: 1'].view.fitView()
d  = p.datums
p.DatumPlaneByThreePoints(point1=r[1], point2=d[3], point3=d[2])
p.DatumAxisByPrincipalAxis(principalAxis=YAXIS)
p.DatumPointByOffset(point=r[1], vector=(2.0, 0.0, 0.0))
p.DatumPointByOffset(point=d[6], vector=(2.0, 0.0, 0.0))
p.DatumPointByOffset(point=d[7], vector=(2.0, 0.0, 0.0))
p.DatumPointByOffset(point=d[6], vector=(0.667, 0.0, 0.0))
p.DatumPointByOffset(point=d[7], vector=(1.333, 0.0, 0.0))
session.viewports['Viewport: 1'].view.fitView()
p = mdb.models['Model-1'].parts['Truss']
t = p.MakeSketchTransform(sketchPlane=d[4], sketchUpEdge=d[5], 
    sketchPlaneSide=SIDE1, sketchOrientation=LEFT, origin=(0.0, 0.0, 0.0))
s = mdb.models['Model-1'].Sketch(name='__profile__', sheetSize=20.00, 
    gridSpacing=2.00, transform=t)
g, v, d2 = s.geometry, s.vertices, s.dimensions
s.setPrimaryObject(option=SUPERIMPOSE)
p.projectReferencesOntoSketch(sketch=s, filter=COPLANAR_EDGES)
r1 = s.referenceVertices
session.viewports['Viewport: 1'].view.setValues(nearPlane=647.932, 
    farPlane=719.417, width=13.6906, height=9.44982, cameraPosition=(-73.2275, 
    0.608064, 679.459), cameraTarget=(3.17147, 0.608064, 0.356791))
s.Line(point1=(0.0, 0.0), point2=(8.05046582503149, 1.5))
s.Line(point1=(8.05046582503149, 1.5), point2=(0.0, 1.0))
s.VerticalConstructionLine(point=(1.9874626323176, 0.0))
s.VerticalConstructionLine(point=(2.65028142019552, 0.0))
s.VerticalConstructionLine(point=(3.97492526463521, 0.0))
s.VerticalConstructionLine(point=(5.29956910907489, 0.0))
s.VerticalConstructionLine(point=(5.96238789695281, 0.0))
s.Line(point1=(0.0, 1.0), point2=(1.9874626323176, 0.370313223268013))
s.Line(point1=(1.9874626323176, 0.370313223268013), point2=(2.65028142019552, 
    1.16460422774263))
s.Line(point1=(2.65028142019552, 1.16460422774263), point2=(4.02523291251575, 
    0.75))
s.Line(point1=(4.02523291251575, 0.75), point2=(5.29956910907489, 
    1.32914673661472))
s.Line(point1=(5.29956910907489, 1.32914673661472), point2=(5.96238789695281, 
    1.11093966980404))
mdb.models['Model-1'].Sketch(name='Truss', objectToCopy=s)
s.constraintReferences(vertex1=r1.findAt((8.050466, 1.5), 1))
p.Wire(sketchPlane=d[4], sketchUpEdge=d[5], sketchPlaneSide=SIDE1, 
    sketchOrientation=LEFT, sketch=s)
s.unsetPrimaryObject()
del mdb.models['Model-1'].sketches['__profile__']
session.viewports['Viewport: 1'].view.fitView()
p.DatumPointByOffset(point=d[2], vector=(0.0, 0.0, 2.0))
p.DatumPointByOffset(point=r[1], vector=(0.0, 0.0, 2.0))
p.DatumPointByOffset(point=d[3], vector=(0.0, 0.0, 0.2))
session.viewports['Viewport: 1'].view.setValues(nearPlane=13.3358, 
    farPlane=22.0145, width=7.00996, height=4.83856, cameraPosition=(12.3848, 
    6.17033, 15.515), cameraUpVector=(-0.184064, 0.953048, -0.240458))
p.DatumPlaneByThreePoints(point1=d[13], point2=d[14], point3=d[12])
t = p.MakeSketchTransform(sketchPlane=d[15], sketchUpEdge=d[5], 
    sketchPlaneSide=SIDE1, sketchOrientation=LEFT, origin=(4.122203, 0.75, 
    1.536252))
s1 = mdb.models['Model-1'].Sketch(name='__profile__', sheetSize=20.0, 
    gridSpacing=2.0, transform=t)
g, v, d2 = s1.geometry, s1.vertices, s1.dimensions
s1.setPrimaryObject(option=SUPERIMPOSE)
p.projectReferencesOntoSketch(sketch=s1, filter=COPLANAR_EDGES)
r1 = s1.referenceVertices
s1.retrieveSketch(sketch=mdb.models['Model-1'].sketches['Truss'])
s1.moveVertices(vector=(-4.14820681508444, -0.75), vertexList=(v[13], v[14], 
    v[15], v[16], v[17], v[18], v[19], v[20], v[21], v[22], v[23], v[24], 
    v[25], v[26], v[27], v[28], v[29], v[30]))
p.Wire(sketchPlane=d[15], sketchUpEdge=d[5], sketchPlaneSide=SIDE1, 
    sketchOrientation=LEFT, sketch=s1)
s1.unsetPrimaryObject()
del mdb.models['Model-1'].sketches['__profile__']
##
##  dummy part
##
p = mdb.models['Model-1'].parts['Truss']
session.viewports['Viewport: 1'].setValues(displayedObject=p)
p = mdb.models['Model-1'].Part(name='Truss-all', 
    objectToCopy=mdb.models['Model-1'].parts['Truss'])
session.viewports['Viewport: 1'].setValues(displayedObject=p)
p = mdb.models['Model-1'].parts['Truss-all']
v = p.vertices
p.WirePolyLine(points=(v.findAt(coordinates=(1.975004, 0.370313, 1.777812)), 
    v.findAt(coordinates=(1.975004, 0.370313, 0.222188)), v.findAt(
    coordinates=(2.633668, 1.164604, 1.703712)), v.findAt(coordinates=(
    2.633668, 1.164604, 0.296288))), mergeWire=ON)
p = mdb.models['Model-1'].parts['Truss-all']
v1 = p.vertices
p.WirePolyLine(points=(v1.findAt(coordinates=(4.0, 0.75, 1.55)), v1.findAt(
    coordinates=(4.0, 0.75, 0.45)), v1.findAt(coordinates=(5.266348, 1.329147, 
    1.407536)), v1.findAt(coordinates=(5.266348, 1.329147, 0.592464)), 
    v1.findAt(coordinates=(5.925012, 1.11094, 1.333436)), v1.findAt(
    coordinates=(5.925012, 1.11094, 0.666564))), mergeWire=ON)
##
##  create cross brace part in the assembly module
##
import assembly
a = mdb.models['Model-1'].rootAssembly
session.viewports['Viewport: 1'].setValues(displayedObject=a)
##  Set coordinate system (done by default)
a.DatumCsysByDefault(CARTESIAN)
p = mdb.models['Model-1'].parts['Truss']
a.Instance(name='Truss-1', part=p, dependent=ON)
p = mdb.models['Model-1'].parts['Truss-all']
a.Instance(name='Truss-all-1', part=p, dependent=ON)
a.PartFromBooleanCut(name='Cross brace', 
    instanceToBeCut=a.instances['Truss-all-1'], 
    cuttingInstances=(a.instances['Truss-1'], ))
p = mdb.models['Model-1'].parts['Cross brace']
a.Instance(name='Cross brace-1', part=p, dependent=ON)
a.suppressFeatures(('Truss-1', 'Truss-all-1', ))
a.features['Truss-1'].resume()
##
##  Switch back to the property module
##
import material
import section
p = mdb.models['Model-1'].parts['Cross brace']
session.viewports['Viewport: 1'].setValues(displayedObject=p)
##
##  Create beam profiles and beam sections
##
mdb.models['Model-1'].BoxProfile(name='MainBoxProfile', b=0.05, 
    a=0.1, uniformThickness=ON, t1=0.005)
mdb.models['Model-1'].BoxProfile(name='BraceBoxProfile', b=0.03, 
    a=0.03, uniformThickness=ON, t1=0.003)
mdb.models['Model-1'].BeamSection(name='MainMemberSection', 
    profile='MainBoxProfile', 
    integration=BEFORE_ANALYSIS, table=((200000000000.0, 80000000000.0),))
mdb.models['Model-1'].BeamSection(name='BracingSection', 
    profile='BraceBoxProfile', 
    integration=BEFORE_ANALYSIS, table=((200000000000.0, 80000000000.0),))
##
##  Assign beam sections to the cross brace
##
p2 = mdb.models['Model-1'].parts['Cross brace']
e = p2.edges
edges = e.findAt(((2.633668, 1.164604, 1.351856), ), ((2.13967, 0.568886, 
    0.592569), ), ((1.975004, 0.370313, 1.388906), ), ((5.431014, 1.274595, 
    0.777707), ), ((5.925012, 1.11094, 1.166718), ), ((5.266348, 1.329147, 
    1.203768), ), ((4.316587, 0.894787, 0.689384), ), ((4.0, 0.75, 1.275), ))
region = regionToolset.Region(edges=edges)
p1 = mdb.models['Model-1'].parts['Cross brace']
p1.SectionAssignment(region=region, sectionName='BracingSection')
##
##  Assign beam sections to the internal bracing
##
p2 = mdb.models['Model-1'].parts['Truss']
e = p2.edges
edges = e.findAt(((5.431014, 1.274595, 0.610989), ), ((4.316587, 0.894787, 
    0.485616), ), ((2.975251, 1.060953, 0.334716), ), ((2.13967, 0.568886, 
    0.240713), ), ((0.493751, 0.842578, 0.055547), ), ((5.431014, 1.274595, 
    1.389011), ), ((4.316587, 0.894787, 1.514384), ), ((2.975251, 1.060953, 
    1.665284), ), ((2.13967, 0.568886, 1.759287), ), ((0.493751, 0.842578, 
    1.944453), ))
region = regionToolset.Region(edges=edges)
p1 = mdb.models['Model-1'].parts['Truss']
p1.SectionAssignment(region=region, sectionName='BracingSection')
##
##  Assign beam sections to the main members
##
p2 = mdb.models['Model-1'].parts['Truss']
e = p2.edges
edges = e.findAt(((4.481253, 0.840235, 0.504141), ), ((7.316587, 1.457287, 
    0.823116), ), ((6.443759, 1.208205, 0.724923), ), ((1.975251, 1.123453, 
    0.222216), ), ((4.608178, 1.288011, 0.51842), ), ((2.481253, 0.465235, 
    0.279141), ), ((0.493751, 0.092578, 0.055547), ), ((4.481253, 0.840235, 
    1.495859), ), ((7.316587, 1.457287, 1.176884), ), ((6.443759, 1.208205, 
    1.275077), ), ((1.975251, 1.123453, 1.777784), ), ((4.608178, 1.288011, 
    1.48158), ), ((2.481253, 0.465235, 1.720859), ), ((0.493751, 0.092578, 
    1.944453), ))
region = regionToolset.Region(edges=edges)
p1 = mdb.models['Model-1'].parts['Truss']
p1.SectionAssignment(region=region, sectionName='MainMemberSection')
##
##  Assign beam section orientations to truss 'B'
##
p2 = mdb.models['Model-1'].parts['Truss']
e = p2.edges
edges = e.findAt(((5.431014, 1.274595, 0.610989), ), ((4.481253, 0.840235, 
    0.504141), ), ((4.316587, 0.894787, 0.485616), ), ((7.316587, 1.457287, 
    0.823116), ), ((6.443759, 1.208205, 0.724923), ), ((2.975251, 1.060953, 
    0.334716), ), ((2.13967, 0.568886, 0.240713), ), ((0.493751, 0.842578, 
    0.055547), ), ((1.975251, 1.123453, 0.222216), ), ((4.608178, 1.288011, 
    0.51842), ), ((2.481253, 0.465235, 0.279141), ), ((0.493751, 0.092578, 
    0.055547), ))
region=regionToolset.Region(edges=edges)
p1 = mdb.models['Model-1'].parts['Truss']
p1.assignBeamSectionOrientation(region=region, method=N1_COSINES, n1=(-0.1118, 
    0.0, 0.9936))
##
##  Assign beam section orientations to truss 'A'
##
p2 = mdb.models['Model-1'].parts['Truss']
e = p2.edges
edges = e.findAt(((5.431014, 1.274595, 1.389011), ), ((4.481253, 0.840235, 
    1.495859), ), ((4.316587, 0.894787, 1.514384), ), ((7.316587, 1.457287, 
    1.176884), ), ((6.443759, 1.208205, 1.275077), ), ((2.975251, 1.060953, 
    1.665284), ), ((2.13967, 0.568886, 1.759287), ), ((0.493751, 0.842578, 
    1.944453), ), ((1.975251, 1.123453, 1.777784), ), ((4.608178, 1.288011, 
    1.48158), ), ((2.481253, 0.465235, 1.720859), ), ((0.493751, 0.092578, 
    1.944453), ))
region=regionToolset.Region(edges=edges)
p1 = mdb.models['Model-1'].parts['Truss']
p1.assignBeamSectionOrientation(region=region, method=N1_COSINES, n1=(-0.1118, 
    0.0, -0.9936))
##
##  Assign beam section orientations to 'Cross brace'
##
p3 = mdb.models['Model-1'].parts['Cross brace']
e = p3.edges
edges = e.findAt(((2.633668, 1.164604, 1.351856), ), ((2.13967, 0.568886, 
    0.592569), ), ((1.975004, 0.370313, 1.388906), ), ((5.431014, 1.274595, 
    0.777707), ), ((5.925012, 1.11094, 1.166718), ), ((5.266348, 1.329147, 
    1.203768), ), ((4.316587, 0.894787, 0.689384), ), ((4.0, 0.75, 1.275), ))
region=regionToolset.Region(edges=edges)
p1 = mdb.models['Model-1'].parts['Cross brace']
p1.assignBeamSectionOrientation(region=region, method=N1_COSINES,
    n1=(0.0, 1.0, 0.0))
##
##  Switch back to the assembly module
##
import assembly
import part
a = mdb.models['Model-1'].rootAssembly
session.viewports['Viewport: 1'].setValues(displayedObject=a)
a.regenerate()
##
##
a = mdb.models['Model-1'].rootAssembly
session.viewports['Viewport: 1'].assemblyDisplay.setValues(
    visibleInstances=('Truss-1', 'Cross brace-1'))
session.viewports['Viewport: 1'].assemblyDisplay.geometryOptions.setValues(
    geometryEdgesInShaded=OFF, datumPoints=OFF, datumAxes=OFF, datumPlanes=OFF,
    datumCoordSystems=OFF, referencePointLabels=OFF, referencePointSymbols=OFF)
##
##  Translate the truss
##
a = mdb.models['Model-1'].rootAssembly
p = a.instances['Truss-1']
d = a.instances['Truss-1'].datums
a.DatumPointByMidPoint(point1=d[13], point2=d[2])
p.translate(vector=(0.0, -0.5, -1.0))
##
##  Translate the cross brace
##
p = a.instances['Cross brace-1']
p.translate(vector=(0.0, -0.5, -1.0))


##
##  Create geometry sets
##
session.viewports['Viewport: 1'].assemblyDisplay.setValues(
    visibleInstances=('Truss-1', ))
session.viewports['Viewport: 1'].assemblyDisplay.geometryOptions.setValues(
    datumPoints=OFF)

a = mdb.models['Model-1'].rootAssembly
v1 = a.instances['Truss-1'].vertices
a.Set(vertices=v1.findAt(
    ((-4.63719995735801e-09, -0.500000000000001, -1.00000002883333), ), 
    ((-4.63719995735801e-09, 0.499999999999999, -1.00000002883333), ), )+\
    v1.findAt(((-5.29858024123087e-09, -0.499999999999995, 0.999999940515274), ),
    ((4.63720173371485e-09, 0.500000000000001, 1.00000002883332), ), ), 
    name='Attach')

a = mdb.models['Model-1'].rootAssembly
v1 = a.instances['Truss-1'].vertices
a.Set(vertices=v1.findAt(
    ((7.99999997181406, 0.999999999999999, 0.0999999609778481), ), ), 
    name='Tip-a')

a = mdb.models['Model-1'].rootAssembly
v1 = a.instances['Truss-1'].vertices
a.Set(vertices=v1.findAt(
    ((7.99999997096321, 0.999999999999999, -0.100000035853851), ), ), 
    name='Tip-b')

a1 = mdb.models['Model-1'].rootAssembly
e1 = a1.instances['Truss-1'].edges
a1.Set(edges=e1.findAt((
    (6.50000008790022, 0.71875002096152, 0.268749944564204), ), ), 
    name='Leg-a')

a1 = mdb.models['Model-1'].rootAssembly
e1 = a1.instances['Truss-1'].edges
a1.Set(edges=e1.findAt((
    (6.50000008733291, 0.718750020961519, -0.268750021960591), ), ), 
    name='Leg-b')

a1 = mdb.models['Model-1'].rootAssembly
edges1 = e1.findAt(((4.316587, 0.394787, 0.514384), ))
a1.Set(edges=edges1, name='Inner-a')

a1 = mdb.models['Model-1'].rootAssembly
edges1 = e1.findAt(((4.316587, 0.394787, -0.514384), ))
a1.Set(edges=edges1, name='Inner-b')

session.viewports['Viewport: 1'].assemblyDisplay.setValues(
    visibleInstances=('Cross brace-1', ))
session.viewports['Viewport: 1'].view.setValues(
    cameraPosition=(7.4736, 8.3559, 20.002),
    cameraUpVector=(-0.34023, 0.72044, -0.60432))

session.viewports['Viewport: 1'].assemblyDisplay.setValues(
    visibleInstances=('Truss-1', 'Cross brace-1'))
session.viewports['Viewport: 1'].view.setValues(session.views['Iso'])
##
##  Switch to the step module
##
import step
##
##  Create a static general step
##
mdb.models['Model-1'].StaticStep(name='Tip load', 
    previous='Initial', description="""Static tip load on crane""", 
    timePeriod=1, adiabatic=OFF, maxNumInc=100, 
    stabilization=None, timeIncrementationMethod=AUTOMATIC, initialInc=1, 
    minInc=1e-05, maxInc=1, matrixSolver=SOLVER_DEFAULT, amplitude=RAMP, 
    extrapolation=LINEAR, fullyPlastic="")
session.viewports['Viewport: 1'].assemblyDisplay.setValues(step='Tip load')
##
##  Modify output requests
##
mdb.models['Model-1'].fieldOutputRequests['F-Output-1'].setValues(
    variables=('U', 'RF', 'SF'))
mdb.models['Model-1'].historyOutputRequests['H-Output-1'].setValues(
    variables=PRESELECT)
##
##  Switch to the interaction module
##
import interaction
##
##  Create constraints between the tips of the truss
##
session.viewports['Viewport: 1'].assemblyDisplay.setValues(interactions=ON)
mdb.models['Model-1'].Equation(name='TipConstraint-1', 
    terms=((1.0, 'Tip-a', 1), (-1.0, 'Tip-b', 1)))
mdb.models['Model-1'].Constraint('TipConstraint-2', 
    mdb.models['Model-1'].constraints['TipConstraint-1'])
mdb.models['Model-1'].constraints['TipConstraint-2'].setValues(
    terms=((1.0, 'Tip-a', 2), (-1.0, 'Tip-b', 2)))
##
##  Create JOIN connectors between truss and bracing
##
mdb.models['Model-1'].ConnectorProperty(name='ConnProp-1', assembledType=None, 
    translationalType=JOIN, rotationalType=None)

a = mdb.models['Model-1'].rootAssembly
v1 = a.instances['Truss-1'].vertices
v2 = a.instances['Cross brace-1'].vertices
point1=v1.findAt(coordinates=(1.975004, -0.129687, 0.777812))
point2=v2.findAt(coordinates=(1.975004, -0.129687, 0.777812))
mdb.models['Model-1'].Connector(name='Conn-1', point1=point1, point2=point2, 
    property='ConnProp-1')
#: The connector "Conn-1" has been created.

a = mdb.models['Model-1'].rootAssembly
v1 = a.instances['Truss-1'].vertices
v2 = a.instances['Cross brace-1'].vertices
point1=v1.findAt(coordinates=(1.975004, -0.129687, -0.777812))
point2=v2.findAt(coordinates=(1.975004, -0.129687, -0.777812))
mdb.models['Model-1'].Connector(name='Conn-2', point1=point1, point2=point2, 
    property='ConnProp-1')
#: The connector "Conn-2" has been created.

a = mdb.models['Model-1'].rootAssembly
v1 = a.instances['Truss-1'].vertices
v2 = a.instances['Cross brace-1'].vertices
point1=v1.findAt(coordinates=(2.633668, 0.664604, 0.703712))
point2=v2.findAt(coordinates=(2.633668, 0.664604, 0.703712))
mdb.models['Model-1'].Connector(name='Conn-3', point1=point1, point2=point2, 
    property='ConnProp-1')
#: The connector "Conn-3" has been created.

a = mdb.models['Model-1'].rootAssembly
v1 = a.instances['Truss-1'].vertices
v2 = a.instances['Cross brace-1'].vertices
point1=v1.findAt(coordinates=(2.633668, 0.664604, -0.703712))
point2=v2.findAt(coordinates=(2.633668, 0.664604, -0.703712))
mdb.models['Model-1'].Connector(name='Conn-4', point1=point1, point2=point2, 
    property='ConnProp-1')
#: The connector "Conn-4" has been created.

a = mdb.models['Model-1'].rootAssembly
v1 = a.instances['Truss-1'].vertices
v2 = a.instances['Cross brace-1'].vertices
point1=v1.findAt(coordinates=(4.0, 0.25, 0.55))
point2=v2.findAt(coordinates=(4.0, 0.25, 0.55))
mdb.models['Model-1'].Connector(name='Conn-5', point1=point1, point2=point2, 
    property='ConnProp-1')
#: The connector "Conn-5" has been created.

a = mdb.models['Model-1'].rootAssembly
v1 = a.instances['Truss-1'].vertices
v2 = a.instances['Cross brace-1'].vertices
point1=v1.findAt(coordinates=(4.0, 0.25, -0.55))
point2=v2.findAt(coordinates=(4.0, 0.25, -0.55))
mdb.models['Model-1'].Connector(name='Conn-6', point1=point1, point2=point2, 
    property='ConnProp-1')
#: The connector "Conn-6" has been created.

a = mdb.models['Model-1'].rootAssembly
v1 = a.instances['Truss-1'].vertices
v2 = a.instances['Cross brace-1'].vertices
point1=v1.findAt(coordinates=(5.266348, 0.829147, 0.407536))
point2=v2.findAt(coordinates=(5.266348, 0.829147, 0.407536))
mdb.models['Model-1'].Connector(name='Conn-7', point1=point1, point2=point2, 
    property='ConnProp-1')
#: The connector "Conn-7" has been created.

a = mdb.models['Model-1'].rootAssembly
v1 = a.instances['Truss-1'].vertices
v2 = a.instances['Cross brace-1'].vertices
point1=v1.findAt(coordinates=(5.266348, 0.829147, -0.407536))
point2=v2.findAt(coordinates=(5.266348, 0.829147, -0.407536))
mdb.models['Model-1'].Connector(name='Conn-8', point1=point1, point2=point2, 
    property='ConnProp-1')
#: The connector "Conn-8" has been created.

a = mdb.models['Model-1'].rootAssembly
v1 = a.instances['Truss-1'].vertices
v2 = a.instances['Cross brace-1'].vertices
point1=v1.findAt(coordinates=(5.925012, 0.61094, 0.333436))
point2=v2.findAt(coordinates=(5.925012, 0.61094, 0.333436))
mdb.models['Model-1'].Connector(name='Conn-9', point1=point1, point2=point2, 
    property='ConnProp-1')
#: The connector "Conn-9" has been created.

a = mdb.models['Model-1'].rootAssembly
v1 = a.instances['Truss-1'].vertices
v2 = a.instances['Cross brace-1'].vertices
point1=v1.findAt(coordinates=(5.925012, 0.61094, -0.333436))
point2=v2.findAt(coordinates=(5.925012, 0.61094, -0.333436))
mdb.models['Model-1'].Connector(name='Conn-10', point1=point1, point2=point2, 
    property='ConnProp-1')
#: The connector "Conn-10" has been created.

##
##  Switch to the load module
##
import load
session.viewports['Viewport: 1'].assemblyDisplay.setValues(loads=ON, bcs=ON,
    fields=ON, interactions=OFF)
##
##  Apply encastre bc to set 'Attach'
##
a0 = mdb.models['Model-1'].rootAssembly
region = a0.sets['Attach']
mdb.models['Model-1'].EncastreBC(name='Fixed end', createStepName='Tip load', 
    region=region)
##
##  Apply concentrated force to set 'Tip-b'
##
a0 = mdb.models['Model-1'].rootAssembly
region = a0.sets['Tip-b']
mdb.models['Model-1'].ConcentratedForce(name='Tip load', 
    createStepName='Tip load', region=region, cf2=-10000.0)
##
##  Switch to mesh module
##
import mesh
session.viewports['Viewport: 1'].assemblyDisplay.setValues(mesh=ON, loads=OFF,
    bcs=OFF, fields=OFF)
session.viewports['Viewport: 1'].assemblyDisplay.meshOptions.setValues(
    meshTechnique=ON)
##
##  Assign global seed
##
p = mdb.models['Model-1'].parts['Truss']
p.seedPart(size=2.0)
p = mdb.models['Model-1'].parts['Cross brace']
p.seedPart(size=2.0)
##
##  Assign element type
##
elemType1 = mesh.ElemType(elemCode=B33)
p = mdb.models['Model-1'].parts['Cross brace']
e = p.edges
edges = e.findAt(((2.633668, 1.164604, 1.351856), ), ((2.13967, 0.568886, 
    0.592569), ), ((1.975004, 0.370313, 1.388906), ), ((5.431014, 1.274595, 
    0.777707), ), ((5.925012, 1.11094, 1.166718), ), ((5.266348, 1.329147, 
    1.203768), ), ((4.316587, 0.894787, 0.689384), ), ((4.0, 0.75, 1.275), ))
pickedRegions =(edges, )
p.setElementType(regions=pickedRegions, elemTypes=(elemType1, ))
p = mdb.models['Model-1'].parts['Truss']
e = p.edges
edges1 = e.findAt(((5.431014, 1.274595, 0.610989), ), ((4.316587, 0.894787, 
    0.485616), ), ((2.975251, 1.060953, 0.334716), ), ((2.13967, 0.568886, 
    0.240713), ), ((0.493751, 0.842578, 0.055547), ), ((5.431014, 1.274595, 
    1.389011), ), ((4.316587, 0.894787, 1.514384), ), ((2.975251, 1.060953, 
    1.665284), ), ((2.13967, 0.568886, 1.759287), ), ((0.493751, 0.842578, 
    1.944453), ))
edges2 = e.findAt(((4.481253, 0.840235, 0.504141), ), ((7.316587, 1.457287, 
    0.823116), ), ((6.443759, 1.208205, 0.724923), ), ((1.975251, 1.123453, 
    0.222216), ), ((4.608178, 1.288011, 0.51842), ), ((2.481253, 0.465235, 
    0.279141), ), ((0.493751, 0.092578, 0.055547), ), ((4.481253, 0.840235, 
    1.495859), ), ((7.316587, 1.457287, 1.176884), ), ((6.443759, 1.208205, 
    1.275077), ), ((1.975251, 1.123453, 1.777784), ), ((4.608178, 1.288011, 
    1.48158), ), ((2.481253, 0.465235, 1.720859), ), ((0.493751, 0.092578, 
    1.944453), ))
pickedRegions =(edges1+edges2, )
p.setElementType(regions=pickedRegions, elemTypes=(elemType1, ))
##
##  Generate mesh
##
p = mdb.models['Model-1'].parts['Truss']
p.generateMesh()
p = mdb.models['Model-1'].parts['Cross brace']
p.generateMesh()
##
##  Switch to job module
##
import job
##
##  Add keywords
##
mdb.models['Model-1'].keywordBlock.synchVersions()
mdb.models['Model-1'].keywordBlock.insert(GetBlockPosition('Model-1', '*End Assembly')-1, """*NORMAL, TYPE=ELEMENT
Inner-a,  Inner-a, -0.3986,  0.9114,  0.1025
Inner-b,  Inner-b,  0.3986, -0.9114,  0.1025
Leg-a,    Leg-a,   -0.1820,  0.9829,  0.0205
Leg-b,    Leg-b,    0.1820, -0.9829,  0.0205""")
##
##  Create job
##
mdb.Job(name='Crane', model='Model-1', 
    description='3-D model of light-service cargo crane')

a = mdb.models['Model-1'].rootAssembly
a.regenerate()
##
##  Save model database
##
mdb.saveAs('Crane.cae')