Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations The Obturator on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Edge selection trouble

Status
Not open for further replies.

USBdroid

Marine/Ocean
Aug 13, 2012
4
Hi everybody,

I am trying to write a script to create the geometry of a sailing boat mast. Essentielly it consists of a couple datum points and wires. One wire is to represent the mast (later to be meshed as a beam element). Since the mast has a section that varies along the length (rectangular cross section in the bottom part and circular tapering on the upper part), I am trying to partition the mast but I am having trouble with the functions Region() and findAt().
Here is the script:

# Do not delete the following import lines
from abaqus import *
from abaqusConstants import *
import __main__
import section
import regionToolset
import displayGroupMdbToolset as dgm
import part
import material
import assembly
import step
import interaction
import load
import mesh
import job
import sketch
import visualization
import xyPlot
import displayGroupOdbToolset as dgo
import connectorBehavior
import math

rake=1.000
lower=0.250
n=3


###CALCULATE THE POSITIONS OF THE POINTS IN FUNCTION OF PARAMETERS AND CREATE POINTS###



p = mdb.models['Model-1'].Part(name='Mast', dimensionality=THREE_D,
type=DEFORMABLE_BODY)

#Mast heel point - Reference
p.ReferencePoint(point=(0, 0, 0))
p = mdb.models['Model-1'].parts['Mast']
session.viewports['Viewport: 1'].setValues(displayedObject=p)
#Backstay

p.DatumPointByCoordinate(coords=(-4.3323, 0.745, 0.0))
#Forestay
p = mdb.models['Model-1'].parts['Mast']
p.DatumPointByCoordinate(coords=(1.9177, 0.935, 0.0))
#Upper chainplate port
p = mdb.models['Model-1'].parts['Mast']
p.DatumPointByCoordinate(coords=(0.0, 0.745, -0.78))
#Lower chainplate port
p = mdb.models['Model-1'].parts['Mast']
p.DatumPointByCoordinate(coords=(-lower, 0.735, -0.82))
#Upper chainplate stb
p = mdb.models['Model-1'].parts['Mast']
p.DatumPointByCoordinate(coords=(0.0, 0.745, 0.78))
#Lower chainplate stb
p = mdb.models['Model-1'].parts['Mast']
p.DatumPointByCoordinate(coords=(-lower, 0.735, 0.82))
#Mast at deck level
xmastdeck=0.770*math.tan(rake/360*math.pi*2)
p = mdb.models['Model-1'].parts['Mast']
p.DatumPointByCoordinate(coords=(-xmastdeck, 0.770, 0.0))
#Gooseneck
xgooseneck=1.150*math.sin(rake/360*math.pi*2)
ygooseneck=1.150*math.cos(rake/360*math.pi*2)
p = mdb.models['Model-1'].parts['Mast']
p.DatumPointByCoordinate(coords=(-xgooseneck, ygooseneck, 0.0))
#Spinnaker pole eye
xpoleeye=1.600*math.sin(rake/360*math.pi*2)
ypoleeye=1.600*math.cos(rake/360*math.pi*2)
p = mdb.models['Model-1'].parts['Mast']
p.DatumPointByCoordinate(coords=(-xpoleeye, ypoleeye, 0.0))
#Spreaders at mast
xspreader=3.800*math.sin(rake/360*math.pi*2)
yspreader=3.800*math.cos(rake/360*math.pi*2)
p = mdb.models['Model-1'].parts['Mast']
p.DatumPointByCoordinate(coords=(-xspreader, yspreader, 0.0))
#Tip spreader port
p = mdb.models['Model-1'].parts['Mast']
p.DatumPointByCoordinate(coords=(-xspreader, yspreader, -0.605))
#Tip spreader stb
p = mdb.models['Model-1'].parts['Mast']
p.DatumPointByCoordinate(coords=(-xspreader, yspreader, 0.605))
#Hound
xhound=6.255*math.sin(rake/360*math.pi*2)
yhound=6.255*math.cos(rake/360*math.pi*2)
p = mdb.models['Model-1'].parts['Mast']
p.DatumPointByCoordinate(coords=(-xhound, yhound, 0.0))
#Spinnaker halyard
xspihal=6.355*math.sin(rake/360*math.pi*2)
yspihal=6.355*math.cos(rake/360*math.pi*2)
p = mdb.models['Model-1'].parts['Mast']
p.DatumPointByCoordinate(coords=(-xspihal, yspihal, 0.0))
#Jumper at mast
xjumper=6.455*math.sin(rake/360*math.pi*2)
yjumper=6.455*math.cos(rake/360*math.pi*2)
p = mdb.models['Model-1'].parts['Mast']
p.DatumPointByCoordinate(coords=(-xjumper, yjumper, 0.0))
#Top mainsail board
xmainboard=8.385*math.sin(rake/360*math.pi*2)
ymainboard=8.385*math.cos(rake/360*math.pi*2)
p = mdb.models['Model-1'].parts['Mast']
p.DatumPointByCoordinate(coords=(-xmainboard, ymainboard, 0.0))
#Top mast
xtopmast=8.760*math.sin(rake/360*math.pi*2)
ytopmast=8.760*math.cos(rake/360*math.pi*2)
p = mdb.models['Model-1'].parts['Mast']
p.DatumPointByCoordinate(coords=(-xtopmast, ytopmast, 0.0))
#Tip jumper port
xtipjumper=(0.170*math.cos(rake/360*math.pi*2)-6.455*math.sin(rake/360*math.pi*2))
ytipjumper=(0.170*math.sin(rake/360*math.pi*2)+6.455*math.cos(rake/360*math.pi*2))
p = mdb.models['Model-1'].parts['Mast']
p.DatumPointByCoordinate(coords=(xtipjumper, ytipjumper, -0.36))
#Tip jumper stb
p = mdb.models['Model-1'].parts['Mast']
p.DatumPointByCoordinate(coords=(xtipjumper, ytipjumper, 0.36))
#Bottom jumper diagonal
xbottomjumper=(0.010*math.cos(rake/360*math.pi*2)-3.800*math.sin(rake/360*math.pi*2))
ybottomjumper=(0.010*math.sin(rake/360*math.pi*2)+3.800*math.cos(rake/360*math.pi*2))
p = mdb.models['Model-1'].parts['Mast']
p.DatumPointByCoordinate(coords=(xbottomjumper, ybottomjumper, 0.0))
#Jumper anchorage
p = mdb.models['Model-1'].parts['Mast']
p.DatumPointByCoordinate(coords=(0.05, 0.77, 0.0))


###COPY NINE TIMES THE PART TO CREATE REST OF RIGGING###
p = mdb.models['Model-1'].Part(name='Spreader',
objectToCopy=mdb.models['Model-1'].parts['Mast'])
p = mdb.models['Model-1'].Part(name='Jumper',
objectToCopy=mdb.models['Model-1'].parts['Spreader'])
p = mdb.models['Model-1'].Part(name='UpperPort',
objectToCopy=mdb.models['Model-1'].parts['Mast'])
p = mdb.models['Model-1'].Part(name='LowerPort',
objectToCopy=mdb.models['Model-1'].parts['Mast'])
p = mdb.models['Model-1'].Part(name='UpperStb',
objectToCopy=mdb.models['Model-1'].parts['Mast'])
p = mdb.models['Model-1'].Part(name='LowerStb',
objectToCopy=mdb.models['Model-1'].parts['Mast'])
p = mdb.models['Model-1'].Part(name='Backstay',
objectToCopy=mdb.models['Model-1'].parts['Mast'])
p = mdb.models['Model-1'].Part(name='ForeStay',
objectToCopy=mdb.models['Model-1'].parts['Mast'])
p = mdb.models['Model-1'].Part(name='Jumperwires',
objectToCopy=mdb.models['Model-1'].parts['Mast'])




###CREATE WIRES IN MAST ONLY###
p = mdb.models['Model-1'].parts['Mast']
d, r = p.datums, p.referencePoints
p.WirePolyLine(points=((r[1], d[18]), ), mergeWire=OFF, meshable=ON)
p = mdb.models['Model-1'].parts['Mast']
e = p.edges
edges = e.getSequenceFromMask(mask=('[#1 ]', ), )
p.Set(edges=edges, name='Wire-1-Set-1')

###CREATE MATERIAL SITKA SPRUCE###

mdb.models['Model-1'].Material(name='Sitka Spruce',
description='from "Acoustic of Wood"')
mdb.models['Model-1'].materials['Sitka Spruce'].Elastic(
type=ENGINEERING_CONSTANTS, table=((11600000000.0, 900000000.0,
500000000.0, 0.37, 0.47, 0.43, 39000000.0, 720000000.0, 750000000.0),
))
###PARTITIONING BOTTOM OF MAST FOR SQUARE SECTION###
p = mdb.models['Model-1'].parts['Mast']
e = p.edges
e1 = e.getClosest(coordinates=((-xhound, yhound, 0.0),))
p.PartitionEdgeByParam(edges=(e1[0][0],), parameter=1-0.0879)
#create square profile and section to assign to lower part of mast#
mdb.models['Model-1'].RectangularProfile(name='Profile-square', a=0.1, b=0.1)
mdb.models['Model-1'].BeamSection(name='Section-square', profile='Profile-square',
integration=DURING_ANALYSIS, poissonRatio=0.0, material='Sitka Spruce',
temperatureVar=LINEAR)
#assign square section to bottom mast#
p = mdb.models['Model-1'].parts['Mast']
e = p.edges
e2 = e.findAt(coordinates=(-xmastdeck, 0.770, 0.0))
region=regionToolset.Region((e2,),)
p = mdb.models['Model-1'].parts['Mast']
p.SectionAssignment(region=region, sectionName='Section-square', offset=0.0,
offsetType=MIDDLE_SURFACE, offsetField='')


On the before before last line (region=...) it always comes back with the following error message: "TypeError: arg1; found tuple, expecting GeomSequence"


I tried several different things to obtain this GeomSequence but cannot get there.

Could anyone help?


Kind Regards

Gaspar
 
Replies continue below

Recommended for you

Hi everybody,

first of all, apologies for not cutting the script down.
I managed to solve my problem: I was just missing a bracket and a comma to make abaqus recognise a GeomSequence;
###PARTITIONING BOTTOM OF MAST FOR SQUARE SECTION###
p = mdb.models['Model-1'].parts['Mast']
e = p.edges
e1 = e.getClosest(coordinates=((-xhound, yhound, 0.0),))
p.PartitionEdgeByParam(edges=(e1[0][0],), parameter=1-0.0879)
#create square profile and section to assign to lower part of mast#
mdb.models['Model-1'].RectangularProfile(name='Profile-square', a=0.1, b=0.1)
mdb.models['Model-1'].BeamSection(name='Section-square', profile='Profile-square',
integration=DURING_ANALYSIS, poissonRatio=0.0, material='Sitka Spruce',
temperatureVar=LINEAR)
#assign square section to bottom mast#
p = mdb.models['Model-1'].parts['Mast']
e = p.edges

region=regionToolset.Region(edges=e.findAt(((0.0,0.0,0.0),),))
p = mdb.models['Model-1'].parts['Mast']
p.SectionAssignment(region=region, sectionName='Section-square', offset=0.0,
offsetType=MIDDLE_SURFACE, offsetField='')

Hopefully this script could help someone later on.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor