Hi! For the following model, I am creating a script that can create x exterior element surfaces to exert x pressure forces on. Currently, I am able to select all the exterior element surfaces at once, to exert pressure forces on (see screenshots). The rpy. code that comes with that is added at the bottom. I am looking for a way to automate these steps for other Abaqus/CAE files (can be a square, box, cylinder, etc.). Is there an easier way to select an x amount of random exterior element surfaces using Python code?
Previous question: https://r1132100503382-eu1-3dswym.3dexperience.3ds.com/#community:39/iquestion:frwEIUqHTviHGHsavDhTcw
p = mdb.models['Model-1'].parts['Part-1'] f = p.elements face1Elements = f[4869:6492] face2Elements = f[0:1623] face4Elements = f[0:1]+f[3:4]+f[6:9]+f[32:33]+f[34:35]+f[40:42]+f[58:59]+\ f[80:81]+f[83:84]+f[87:89]+f[92:93]+f[117:118]+f[147:148]+f[156:157]+\ f[176:177]+f[186:187]+f[189:190]+f[419:420]+f[504:505]+f[514:516]+\ f[521:523]+f[525:528]+f[533:534]+f[536:538]+f[539:540]+f[545:546]+\ f[548:549]+f[552:553]+f[555:558]+f[560:561]+f[562:563]+f[565:566]+\ f[567:569]+f[573:574]+f[576:577]+f[578:580]+f[586:587]+f[597:598]+\ f[602:603]+f[607:609]+f[611:612]+f[613:614]+f[616:617]+f[618:619]+\ f[621:622]+f[626:627]+f[630:631]+f[632:634]+f[635:636]+f[645:646]+\ f[1623:1624]+f[1626:1627]+f[1629:1632]+f[1655:1656]+f[1657:1658]+\ f[1663:1665]+f[1681:1682]+f[1703:1704]+f[1706:1707]+f[1710:1712]+\ f[1715:1716]+f[1740:1741]+f[1770:1771]+f[1779:1780]+f[1799:1800]+\ f[1809:1810]+f[1812:1813]+f[2042:2043]+f[2127:2128]+f[2137:2139]+\ f[2144:2146]+f[2148:2151]+f[2156:2157]+f[2159:2161]+f[2162:2163]+\ f[2168:2169]+f[2171:2172]+f[2175:2176]+f[2178:2181]+f[2183:2184]+\ f[2185:2186]+f[2188:2189]+f[2190:2192]+f[2196:2197]+f[2199:2200]+\ f[2201:2203]+f[2209:2210]+f[2220:2221]+f[2225:2226]+f[2230:2232]+\ f[2234:2235]+f[2236:2237]+f[2239:2240]+f[2241:2242]+f[2244:2245]+\ f[2249:2250]+f[2253:2254]+f[2255:2257]+f[2258:2259]+f[2268:2269]+\ f[3246:3247]+f[3249:3250]+f[3252:3255]+f[3278:3279]+f[3280:3281]+\ f[3286:3288]+f[3304:3305]+f[3326:3327]+f[3329:3330]+f[3333:3335]+\ f[3338:3339]+f[3363:3364]+f[3393:3394]+f[3402:3403]+f[3422:3423]+\ f[3432:3433]+f[3435:3436]+f[3665:3666]+f[3750:3751]+f[3760:3762]+\ f[3767:3769]+f[3771:3774]+f[3779:3780]+f[3782:3784]+f[3785:3786]+\ f[3791:3792]+f[3794:3795]+f[3798:3799]+f[3801:3804]+f[3806:3807]+\ f[3808:3809]+f[3811:3812]+f[3813:3815]+f[3819:3820]+f[3822:3823]+\ f[3824:3826]+f[3832:3833]+f[3843:3844]+f[3848:3849]+f[3853:3855]+\ f[3857:3858]+f[3859:3860]+f[3862:3863]+f[3864:3865]+f[3867:3868]+\ f[3872:3873]+f[3876:3877]+f[3878:3880]+f[3881:3882]+f[3891:3892]+\ f[4869:4870]+f[4872:4873]+f[4875:4878]+f[4901:4902]+f[4903:4904]+\ f[4909:4911]+f[4927:4928]+f[4949:4950]+f[4952:4953]+f[4956:4958]+\ f[4961:4962]+f[4986:4987]+f[5016:5017]+f[5025:5026]+f[5045:5046]+\ f[5055:5056]+f[5058:5059]+f[5288:5289]+f[5373:5374]+f[5383:5385]+\ f[5390:5392]+f[5394:5397]+f[5402:5403]+f[5405:5407]+f[5408:5409]+\ f[5414:5415]+f[5417:5418]+f[5421:5422]+f[5424:5427]+f[5429:5430]+\ f[5431:5432]+f[5434:5435]+f[5436:5438]+f[5442:5443]+f[5445:5446]+\ f[5447:5449]+f[5455:5456]+f[5466:5467]+f[5471:5472]+f[5476:5478]+\ f[5480:5481]+f[5482:5483]+f[5485:5486]+f[5487:5488]+f[5490:5491]+\ f[5495:5496]+f[5499:5500]+f[5501:5503]+f[5504:5505]+f[5514:5515] face6Elements = f[1:3]+f[4:6]+f[31:32]+f[42:43]+f[45:46]+f[60:61]+f[77:78]+\ f[89:92]+f[101:103]+f[118:119]+f[136:137]+f[139:141]+f[151:152]+f[155:156]+\ f[163:164]+f[165:166]+f[167:168]+f[177:178]+f[188:189]+f[195:196]+\ f[203:205]+f[231:232]+f[418:419]+f[473:474]+f[518:521]+f[523:525]+\ f[529:533]+f[538:539]+f[540:544]+f[546:548]+f[550:552]+f[553:555]+\ f[559:560]+f[561:562]+f[563:564]+f[566:567]+f[569:573]+f[574:576]+\ f[1624:1626]+f[1627:1629]+f[1654:1655]+f[1665:1666]+f[1668:1669]+\ f[1683:1684]+f[1700:1701]+f[1712:1715]+f[1724:1726]+f[1741:1742]+\ f[1759:1760]+f[1762:1764]+f[1774:1775]+f[1778:1779]+f[1786:1787]+\ f[1788:1789]+f[1790:1791]+f[1800:1801]+f[1811:1812]+f[1818:1819]+\ f[1826:1828]+f[1854:1855]+f[2041:2042]+f[2096:2097]+f[2141:2144]+\ f[2146:2148]+f[2152:2156]+f[2161:2162]+f[2163:2167]+f[2169:2171]+\ f[2173:2175]+f[2176:2178]+f[2182:2183]+f[2184:2185]+f[2186:2187]+\ f[2189:2190]+f[2192:2196]+f[2197:2199]+f[3247:3249]+f[3250:3252]+\ f[3277:3278]+f[3288:3289]+f[3291:3292]+f[3306:3307]+f[3323:3324]+\ f[3335:3338]+f[3347:3349]+f[3364:3365]+f[3382:3383]+f[3385:3387]+\ f[3397:3398]+f[3401:3402]+f[3409:3410]+f[3411:3412]+f[3413:3414]+\ f[3423:3424]+f[3434:3435]+f[3441:3442]+f[3449:3451]+f[3477:3478]+\ f[3664:3665]+f[3719:3720]+f[3764:3767]+f[3769:3771]+f[3775:3779]+\ f[3784:3785]+f[3786:3790]+f[3792:3794]+f[3796:3798]+f[3799:3801]+\ f[3805:3806]+f[3807:3808]+f[3809:3810]+f[3812:3813]+f[3815:3819]+\ f[3820:3822]+f[4870:4872]+f[4873:4875]+f[4900:4901]+f[4911:4912]+\ f[4914:4915]+f[4929:4930]+f[4946:4947]+f[4958:4961]+f[4970:4972]+\ f[4987:4988]+f[5005:5006]+f[5008:5010]+f[5020:5021]+f[5024:5025]+\ f[5032:5033]+f[5034:5035]+f[5036:5037]+f[5046:5047]+f[5057:5058]+\ f[5064:5065]+f[5072:5074]+f[5100:5101]+f[5287:5288]+f[5342:5343]+\ f[5387:5390]+f[5392:5394]+f[5398:5402]+f[5407:5408]+f[5409:5413]+\ f[5415:5417]+f[5419:5421]+f[5422:5424]+f[5428:5429]+f[5430:5431]+\ f[5432:5433]+f[5435:5436]+f[5438:5442]+f[5443:5445] p.Surface(face1Elements=face1Elements, face2Elements=face2Elements, face4Elements=face4Elements, face6Elements=face6Elements, name='Surf-1') #: The surface 'Surf-1' has been created (3750 mesh faces). p1 = mdb.models['Model-1'].parts['Part-1'] session.viewports['Viewport: 1'].setValues(displayedObject=p1) a = mdb.models['Model-1'].rootAssembly a.regenerate() session.viewports['Viewport: 1'].setValues(displayedObject=a) session.viewports['Viewport: 1'].assemblyDisplay.setValues(mesh=OFF, loads=ON, bcs=ON, predefinedFields=ON, connectors=ON) session.viewports['Viewport: 1'].assemblyDisplay.meshOptions.setValues( meshTechnique=OFF) a = mdb.models['Model-1'].rootAssembly region = a.instances['Part-1-1'].surfaces['Surf-1'] mdb.models['Model-1'].Pressure(name='Load-1', createStepName='LoadingStep', region=region, distributionType=UNIFORM, field='', magnitude=1.0, amplitude='Sin')