-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f3d497
commit 7cc1f40
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# ============================================================================ # | ||
# When importing INP file into Abaqus, cells are considered as sets in the # | ||
# assembly. This script copies the sets from the assembly to the 'Part' # | ||
# section. # | ||
# ============================================================================ # | ||
|
||
# Get the current model name and its part name | ||
vps = session.viewports.values()[0] | ||
mdbName=vps.displayedObject.modelName | ||
pk=mdb.models[mdbName].parts.keys() | ||
partName=pk[0] | ||
|
||
# Set the new part visible | ||
p1 = mdb.models[mdbName].parts[partName] | ||
session.viewports['Viewport: 1'].setValues(displayedObject=p1) | ||
|
||
# Fecth all sets in the assembly | ||
a=mdb.models[mdbName].rootAssembly | ||
sets=a.sets | ||
sets_list=sets.keys() | ||
p = mdb.models[mdbName].parts[partName] | ||
|
||
for cellID in sets_list: | ||
set_i=sets[cellID] | ||
if cellID.startswith('CELL'): | ||
IDs=[j.label for j in set_i.elements] | ||
p.SetFromElementLabels(elementLabels=IDs,name=cellID) |