As you can see in the picture, my models are all regular cubes, but I can’t get units that are all regular rectangles or squares when I divide them, so what should I do, I’d like to get your help, thanks in advance!
And here’s my exact script
cubit.cmd('reset')
cubit.cmd('brick x 50 y 40 z 25')
cubit.cmd('move vol 1 x 25 y 20 z -12.5')
cubit.cmd('brick x 50 y 3 z 5')
cubit.cmd('move vol 2 x 25 y 4.5 z -12.5')
cubit.cmd('brick x 50 y 3 z 5')
cubit.cmd('move vol 3 x 25 y 35.5 z -12.5')
cubit.cmd('brick x 8 y 8 z 25')
cubit.cmd('move vol 4 x 25 y 20 z -12.5')
# SUBTRACT VOL B FROM VOL A
cubit.cmd('subtract vol 2 from vol 1')
cubit.cmd('subtract vol 3 from vol 1')
cubit.cmd('subtract vol 4 from vol 1')
cubit.cmd('brick x 8 y 8 z 25')
cubit.cmd('move vol 5 x 25 y 20 z -12.5')
cubit.cmd('webcut vol all plane zplane offset -10 ')
cubit.cmd('webcut vol all plane zplane offset -15 ')
# cubit.cmd('delete volume 9 11')
cubit.cmd('imprint all')
cubit.cmd('merge all')
# Meshing the volumes
cubit.cmd('volume all size 0.5')
cubit.cmd('curve 57 69 72 interval 20')
cubit.cmd('curve 57 69 72 scheme equal')
#cubit.cmd('volume all scheme submap')
# cubit.cmd('volume 5 7 11 scheme submap')
cubit.cmd('mesh volume all')
Hi @sunflower,
i modified your script a bit to keep the tool (volume 4).
#!cubit
reset
brick x 50 y 40 z 25
move vol 1 x 25 y 20 z -12.5
brick x 50 y 3 z 5
move vol 2 x 25 y 4.5 z -12.5
brick x 50 y 3 z 5
move vol 3 x 25 y 35.5 z -12.5
brick x 8 y 8 z 25
move vol 4 x 25 y 20 z -12.5
#SUBTRACT VOL B FROM VOL A
subtract vol 2 from vol 1
subtract vol 3 from vol 1
subtract vol 4 from vol 1 keep_tool
webcut vol all plane zplane offset -10
webcut vol all plane zplane offset -15
imprint all
merge all
#Meshing the volumes
volume all size 1
#surface all scheme submap
mesh volume all
This will already create a mesh with nearly uniform shape and size for the elements.
The autoscheme seems to set the pave scheme for some surfaces.
draw surface all with has_scheme ‘pave’
If we set the submap scheme to all surfaces we get uniform elements.
Thank you very much for your reply, I tried your modified script and it works fine, but when I make a slight modification to use my model, it fails. Here is my script, hopefully you can look at it in for me. I appreciate it.
#!cubit
reset
brick x 100 y 75 z 25
move vol 1 x 50 y 37.5 z -12.5
brick x 100 y 5 z 5
move vol 2 x 50 y 7.5 z -12.5
brick x 100 y 5 z 5
move vol 3 x 50 y 67.5 z -12.5
brick x 15 y 15 z 25
move vol 4 x 50 y 37.5 z -12.5
#SUBTRACT VOL B FROM VOL A
subtract vol 2 from vol 1
subtract vol 3 from vol 1
subtract vol 4 from vol 1 keep_tool
webcut vol all plane zplane offset -10
webcut vol all plane zplane offset -15
imprint all
merge all
#Meshing the volumes
volume all size 1
#surface all scheme submap
mesh volume all
Runs without an error on my machine.
Which cubit version are you using? Could post a screenshot from the error?
It’s not that my code doesn’t work properly, it’s that I can’t get perfectly uniform units like you were operating before.
The elements can’t be uniform when the geometry ratios do not fit.
Take look at the coordinates from the nodes. They should be the same in the x-direction otherwise we will skew the elements a bit.
Adjusting the base volumes from x=100 to x=101 will fix this.
#!cubit
reset
brick x 101 y 75 z 25
move vol 1 x 50 y 37.5 z -12.5
brick x 101 y 5 z 5
move vol 2 x 50 y 7.5 z -12.5
brick x 101 y 5 z 5
move vol 3 x 50 y 67.5 z -12.5
brick x 15 y 15 z 25
move vol 4 x 50 y 37.5 z -12.5
#SUBTRACT VOL B FROM VOL A
subtract vol 2 from vol 1
subtract vol 3 from vol 1
subtract vol 4 from vol 1 keep_tool
webcut vol all plane zplane offset -10
webcut vol all plane zplane offset -15
imprint all
merge all
#Meshing the volumes
volume all size 1
surface all scheme submap
mesh volume all
quality volume all shape and size global draw mesh