Thanks, it is all working now except controlling the meshing for SFI-MVLEM elements and a couple more. I managed to split the panels into 2 or 3 horizontally, but cannot get rid of the diagonal meshing from python code below(this is default ??).
I manually meshed (second snip) a while back but forgot how I did it even manually. This is what I want.
Code: Select all
from PyMpc import *
App.clearTerminal()
doc = App.caeDocument()
# ***********************************************
# EDGES 0 & 2 ARE TOP AND BOTTOM
# EDGES 1 & 3 ARE THE SIDES OF THE WALL
# THIS PYTHON CODE IS TO MESH THE WALL IN 3 MESHES HORIZONTALLY AND NO MESH VERTICALLY
# AS PER SFI-MVLEM MODELLING
# ***********************************************
def Control_Mesh_Wall(div_horizontally):
sides = [1, 3] # List of edge indices to apply the seed to
top_and_bot = [0, 2]
# Setup global controls
mc = doc.meshControls # Access mesh controls only once
for geom_id, geom in doc.geometries.items():
shape = geom.shape
num_vertices = shape.getNumberOfSubshapes(MpcSubshapeType.Vertex)
if num_vertices == 4:# 4 means wall alls
print("Geometry ID =", geom_id)
print("Number of vertices =", num_vertices)
for edge_id in sides:
# Create and apply edge seed
geom_controls = mc.geometryControls[geom_id]
seed = MpcMeshEdgeSeed()
seed.type = MpcMeshEdgeSeedType.UniformByDivisions
seed.divisions = div_horizontally # element will be divided into this number, not the seed number
geom_controls.edgeControls[edge_id].seed = seed
for edge_id in top_and_bot:
# Create and apply edge seed
geom_controls = mc.geometryControls[geom_id]
seed = MpcMeshEdgeSeed()
seed.type = MpcMeshEdgeSeedType.UniformByDivisions
seed.divisions = 1
geom_controls.edgeControls[edge_id].seed = seed
def Control_Mesh_Column(col_list):
mc = doc.meshControls # Access mesh controls only once
for geom_id, geom in doc.geometries.items():
shape = geom.shape
num_vertices = shape.getNumberOfSubshapes(MpcSubshapeType.Vertex)
if geom_id in col_list:
if num_vertices == 2 :
geom_controls = mc.geometryControls[geom_id]
seed = MpcMeshEdgeSeed()
seed.type = MpcMeshEdgeSeedType.UniformByDivisions
seed.divisions = 1 # element will be divided into this number, not the seed number
geom_controls.edgeControls[0].seed = seed # NOTE EDGE ID 0 FOR ALL COLUMN
#Control_Mesh_Wall(1)
doc.commitChanges()
doc.dirty = True
App.runCommand("Regenerate")
App.processEvents()
Can you Plasse provide some tips for below as well ? Much appreciated.
1. How to assign master slave interaction into conditions - constraints.mp.rigid diaphragms from python api. Master - slave interaction is already defined through python.
2. How to merge walls and columns.