Is there a function in Cubit that allows the user to create an array of a single object in cartesian coordinates?
Hi,
I’m going to need a little more description here. Do you mean like a numpy array of coordinates? Do you mean like a copied pattern of geometric objects? I’m not clear what you are asking for.
Thanks,
Karl
Thank you for responding to my question. Yes I would like to make multiple copies of a single geometric object distributed in space by a constant x,y,z spacing, or by a analytical function.
For a simple x, y, z spacing you can use a copy transform operation with the repeat operation. For example,
create cylinder radius 2 z 5
volume 1 copy move x 15 repeat 5
volume 2 to 11 copy rotate 30 about z repeat 11
Cubit has some mathematical functions called APREPRO in its native command language but in general I find it easier to use python.
import numpy as np
cubit.cmd('reset')
radius = 2
height = 5
cubit.cmd(f'cylinder radius {radius} z {height}')
x =np.array( [i for i in range(0,360,30)])
y = 20*np.cos(x*np.pi/180)
xy = [ (x[i], y[i]) for i in range(0, len(x))]
for val in xy:
cubit.cmd(f'volume 1 copy move x {val[0]} y {val[1]}')
cubit.cmd('delete volume 1')
cubit.cmd('compress')
Do these examples help with how to create patterns of objects with Cubit?
Thanks,
Karl
Awesome! Thank you very much for confirming that it can be done, and especially for providing an example of how.