找回密码
 注册
Simdroid-非首页
查看: 315|回复: 5

[二次开发] abaqus2020的python二次开发的分割PartitionCell的边界选取findAt问题

[复制链接]
发表于 2022-1-11 11:12:00 | 显示全部楼层 |阅读模式 来自 广东清远
请教一下各位,关于abaqus的python二次开发命令PartitionCellByPlanePointNormal,发现对某一部件执行该命令(分割部件)的for循环中,固定选取一边作为法线方向,有的时候没有报错有的时候却出现报错,每次循环都要对该边进行重新定义对象变量才保证绝对不会报错,但是循环次数太多则会有效率问题,如何解决比较好。
我发现对一个立方体的三个方向进行10等份分割,尝试运行了下面三种代码都中途中断,不知是什么原因。
  1. m = mdb.Model(name='cube')
  2. s = m.ConstrainedSketch(name='square',sheetSize=100.0)
  3. s.Line(point1=(0.0,0.0),point2=(10.0,0.0))
  4. s.Line(point1=(10.0,0.0),point2=(10.0,10.0))
  5. s.Line(point1=(10.0,10.0),point2=(0.0,10.0))
  6. s.Line(point1=(0.0,10.0),point2=(0.0,0.0))
  7. p=m.Part(name='cube',dimensionality=THREE_D,type=DEFORMABLE_BODY)
  8. p.BaseSolidExtrude(sketch=s,depth=10.0)
  9. e1 = p.edges.findAt(((0.5,0.0,0.0),))
  10. e2 = p.edges.findAt(((0.0,0.5,0.0),))
  11. e3 = p.edges.findAt(((0.0,0.0,0.5),))
  12. for i in range(1,10):
  13.     p.PartitionCellByPlanePointNormal(point=(i,0,0),normal=e1[0],cells=p.cells)
  14.     p.PartitionCellByPlanePointNormal(point=(0,i,0),normal=e2[0],cells=p.cells)
  15.     p.PartitionCellByPlanePointNormal(point=(0,0,i),normal=e3[0],cells=p.cells)
复制代码
  1. m = mdb.Model(name='cube')
  2. s = m.ConstrainedSketch(name='square',sheetSize=100.0)
  3. s.Line(point1=(0.0,0.0),point2=(10.0,0.0))
  4. s.Line(point1=(10.0,0.0),point2=(10.0,10.0))
  5. s.Line(point1=(10.0,10.0),point2=(0.0,10.0))
  6. s.Line(point1=(0.0,10.0),point2=(0.0,0.0))
  7. p=m.Part(name='cube',dimensionality=THREE_D,type=DEFORMABLE_BODY)
  8. p.BaseSolidExtrude(sketch=s,depth=10.0)
  9. for i in range(1,10):
  10.     e1 = p.edges.findAt(((0.5,0.0,0.0),))
  11.     e2 = p.edges.findAt(((0.0,0.5,0.0),))
  12.     e3 = p.edges.findAt(((0.0,0.0,0.5),))
  13.     p.PartitionCellByPlanePointNormal(point=(i,0,0),normal=e1[0],cells=p.cells)
  14.     p.PartitionCellByPlanePointNormal(point=(0,i,0),normal=e2[0],cells=p.cells)
  15.     p.PartitionCellByPlanePointNormal(point=(0,0,i),normal=e3[0],cells=p.cells)
复制代码
  1. m = mdb.Model(name='cube1')
  2. s = m.ConstrainedSketch(name='square',sheetSize=100.0)
  3. s.Line(point1=(0.0,0.0),point2=(10.0,0.0))
  4. s.Line(point1=(10.0,0.0),point2=(10.0,10.0))
  5. s.Line(point1=(10.0,10.0),point2=(0.0,10.0))
  6. s.Line(point1=(0.0,10.0),point2=(0.0,0.0))
  7. p=m.Part(name='cube',dimensionality=THREE_D,type=DEFORMABLE_BODY)
  8. p.BaseSolidExtrude(sketch=s,depth=10.0)
  9. for i in range(1,10):
  10.     e1 = p.edges.findAt(((i,0.0,0.0),))
  11.     e2 = p.edges.findAt(((0.0,i,0.0),))
  12.     e3 = p.edges.findAt(((0.0,0.0,i),))
  13.     c1 = p.cells.findAt(((i,0.0,0.0),))
  14.     c2 = p.cells.findAt(((0.0,i,0.0),))
  15.     c3 = p.cells.findAt(((0.0,0.0,i),))   
  16.     p.PartitionCellByPlanePointNormal(point=(i,0,0),normal=e1[0],cells=c1)
  17.     p.PartitionCellByPlanePointNormal(point=(0,i,0),normal=e2[0],cells=c2)
  18.     p.PartitionCellByPlanePointNormal(point=(0,0,i),normal=e3[0],cells=c3)
复制代码


发表于 2022-1-18 08:45:48 | 显示全部楼层 来自 中国
Simdroid开发平台
代码有问题吧   一般 要需要可以联系QQ664887646 讨论哦
回复 不支持

使用道具 举报

发表于 2022-1-20 08:54:28 | 显示全部楼层 来自 河南
以最后一段代码为例:做以下尝试,如有问题可以加Q:2812468512
    e1 = p.edges.findAt(((i,0.0,0.0),))
    c1 = p.cells.findAt(((i,0.0,0.0),))
    p.PartitionCellByPlanePointNormal(point=(i,0,0),normal=e1[0],cells=c1)
    e2 = p.edges.findAt(((0.0,i,0.0),))
    c2 = p.cells.findAt(((0.0,i,0.0),))
    p.PartitionCellByPlanePointNormal(point=(0,i,0),normal=e2[0],cells=c2)
    e3 = p.edges.findAt(((0.0,0.0,i),))
    c3 = p.cells.findAt(((0.0,0.0,i),))   
    p.PartitionCellByPlanePointNormal(point=(0,0,i),normal=e3[0],cells=c3)
回复 不支持

使用道具 举报

发表于 2022-1-25 08:39:15 | 显示全部楼层 来自 台湾
e1 = p.edges.findAt(((0.5,0.0,0.0),))
e2 = p.edges.findAt(((0.0,0.5,0.0),))
e3 = p.edges.findAt(((0.0,0.0,0.5),))

這個用找出來的edgeArray記得用sets存起來,下次訪問的時候透過p.sets['set-1'].edges[0]去抓取,就不會跑掉,試試看唄
回复 不支持

使用道具 举报

 楼主| 发表于 2022-1-29 16:24:46 | 显示全部楼层 来自 广东汕头
我后来用建立基准轴的方法解决了问题,感谢各位解答
回复 不支持

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Simapps系列直播

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-9-28 14:11 , Processed in 0.031912 second(s), 14 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表