2017-07-28 29 views
0
from part import * 
from material import * 
from section import * 
from assembly import * 
from step import * 
from interaction import * 
from load import * 
from mesh import * 
from optimization import * 
from job import * 
from sketch import * 
from visualization import * 
from connectorBehavior import * 
import numpy as np 
from math import sqrt 

fd =open('circle_input.txt','r') 
d=np.loadtxt(fd,delimiter=',',dtype={'names':('co1','col2','col3'),'formats':('float','float','float')}) 
for i in range(0,len(d),1): 

    Description = 'As particles: '# + 'X = ' + str(x) + ' Y = ' + str(y) + ' Z = ' + str(z) 
    Model = 'Model' 
    print Description 
    print Model 
    mdb.Model(modelType=STANDARD_EXPLICIT, name=Model, description=Description) 

    for j in range(i+1,len(d)): 
    ## Sketch a square 
     mdb.models[Model].ConstrainedSketch(name='__profile__', sheetSize=200.0) 
     mdb.models[Model].sketches['__profile__'].CircleByCenterPerimeter(center=(d[i][0], d[i][1]), point1=(0.0, d[i][2]))    
     mdb.models[Model].Part(dimensionality=TWO_D_PLANAR, name='Part-1', type=DEFORMABLE_BODY) 
     mdb.models[Model].parts['Part-1'].BaseShell(sketch=mdb.models[Model].sketches['__profile__']) 
     del mdb.models[Model].sketches['__profile__'] 

我想從導入的文本文件的同一模型中繪製多個圓。 其中每行精確指定幾何信息的圓心和半徑。如何在abaqus中使用abaqus腳本在同一模型中創建多個零件

下面的代碼我寫的,但它只是在繪製一個圓

任何幫助,將不勝感激

感謝

回答

0

我想你需要到循環之外創建你的一部分。此代碼尚未經過測試。

from part import * 
from material import * 
from section import * 
from assembly import * 
from step import * 
from interaction import * 
from load import * 
from mesh import * 
from optimization import * 
from job import * 
from sketch import * 
from visualization import * 
from connectorBehavior import * 
import numpy as np 
from math import sqrt 

fd =open('circle_input.txt','r') 
d=np.loadtxt(fd,delimiter=',',dtype={'names':('co1','col2','col3'),'formats':('float','float','float')}) 
for i in range(0,len(d),1): 

    Description = 'As particles: '# + 'X = ' + str(x) + ' Y = ' + str(y) + ' Z = ' + str(z) 
    Model = 'Model' 
    print Description 
    print Model 
    model = mdb.Model(modelType=STANDARD_EXPLICIT, name=Model, description=Description) 
    sketch = model.ConstrainedSketch(name='__profile__', sheetSize=200.0) 
    part = model.Part(dimensionality=TWO_D_PLANAR, name='Part-1', type=DEFORMABLE_BODY) 

    for j in range(i+1,len(d)): 
    ## Sketch a square    
     sketch.CircleByCenterPerimeter(center=(d[i][0], d[i][1]), point1=(0.0, d[i][2]))    

    part.BaseShell(sketch=sketch) 
    del model.sketches['__profile__'] 
+0

您好,感謝上面的代碼進行測試,它的工作......如果我想網所有部件用相同的網格劃分,是否公平添加在上面提到的那些loop..i齧合線試過這種但是如果你有相同的部件(相同的網格),你可能應該只有一個部件,並且有許多實例,它會給我縮進的錯誤 –

+0

。 – agentp