NEROOO
Mechanical
- Oct 23, 2019
- 36
Hi there,
I run the python script but it always shows "p.BaseShell(sketch=s), Shell extrude feature failed", looking for help!
Thanks!
import...
s = mdb.models['Model-1'].ConstrainedSketch(name='__profile__',
sheetSize=1400.0)
g, v, d, c = s.geometry, s.vertices, s.dimensions, s.constraints
s.setPrimaryObject(option=STANDALONE)
s.ConstructionLine(point1=(350, 350), angle=0.0)
s.HorizontalConstraint(entity=g[2], addUndoState=False)
s.ConstructionLine(point1=(350, 350), angle=90.0)
s.VerticalConstraint(entity=g[3], addUndoState=False)
f=open('C:/Users/nerooo/Desktop/works/Contour1.txt','r')
contour=[]
coordinate=[]
data=f.readlines()
f.close()
for xy in data:
temp1=xy.strip('\n')
temp2=temp1.split('\t')
contour.append(temp2)
for i in range(len(contour)):
temp3=contour[0].split()
for j in range(len(temp3)):
temp3[j]=int(temp3[j])
coordinate.append(temp3)
s.rectangle(point1=(-100, 600), point2=(600, -100))
for m in range(len(coordinate)):
CoordNum=len(coordinate[m])/2
for n in range(CoordNum):
s.Spot(point=(coordinate[m][n*2], coordinate[m][n*2+1]))
if n:
s.Line(point1=(coordinate[m][(n-1)*2], coordinate[m][(n-1)*2+1]), point2=(coordinate[m][n*2], coordinate[m][n*2+1]))
if CoordNum>2:
s.Line(point1=(coordinate[m][0], coordinate[m][1]), point2=(coordinate[m][(CoordNum-1)*2], coordinate[m][(CoordNum-1)*2+1]))
p = mdb.models['Model-1'].Part(name='Part-1', dimensionality=TWO_D_PLANAR,
type=DEFORMABLE_BODY)
p = mdb.models['Model-1'].parts['Part-1']
p.BaseShell(sketch=s)
s.unsetPrimaryObject()
p = mdb.models['Model-1'].parts['Part-1']
session.viewports['Viewport: 1'].setValues(displayedObject=p)
del mdb.models['Model-1'].sketches['__profile__']
I run the python script but it always shows "p.BaseShell(sketch=s), Shell extrude feature failed", looking for help!
Thanks!
import...
s = mdb.models['Model-1'].ConstrainedSketch(name='__profile__',
sheetSize=1400.0)
g, v, d, c = s.geometry, s.vertices, s.dimensions, s.constraints
s.setPrimaryObject(option=STANDALONE)
s.ConstructionLine(point1=(350, 350), angle=0.0)
s.HorizontalConstraint(entity=g[2], addUndoState=False)
s.ConstructionLine(point1=(350, 350), angle=90.0)
s.VerticalConstraint(entity=g[3], addUndoState=False)
f=open('C:/Users/nerooo/Desktop/works/Contour1.txt','r')
contour=[]
coordinate=[]
data=f.readlines()
f.close()
for xy in data:
temp1=xy.strip('\n')
temp2=temp1.split('\t')
contour.append(temp2)
for i in range(len(contour)):
temp3=contour[0].split()
for j in range(len(temp3)):
temp3[j]=int(temp3[j])
coordinate.append(temp3)
s.rectangle(point1=(-100, 600), point2=(600, -100))
for m in range(len(coordinate)):
CoordNum=len(coordinate[m])/2
for n in range(CoordNum):
s.Spot(point=(coordinate[m][n*2], coordinate[m][n*2+1]))
if n:
s.Line(point1=(coordinate[m][(n-1)*2], coordinate[m][(n-1)*2+1]), point2=(coordinate[m][n*2], coordinate[m][n*2+1]))
if CoordNum>2:
s.Line(point1=(coordinate[m][0], coordinate[m][1]), point2=(coordinate[m][(CoordNum-1)*2], coordinate[m][(CoordNum-1)*2+1]))
p = mdb.models['Model-1'].Part(name='Part-1', dimensionality=TWO_D_PLANAR,
type=DEFORMABLE_BODY)
p = mdb.models['Model-1'].parts['Part-1']
p.BaseShell(sketch=s)
s.unsetPrimaryObject()
p = mdb.models['Model-1'].parts['Part-1']
session.viewports['Viewport: 1'].setValues(displayedObject=p)
del mdb.models['Model-1'].sketches['__profile__']