Dear all,
I would like to create volumes (bricks only) with a Python script based on the 8 corner coordinates.
Is it possible to create brick volumes only with coordinates?
Many thanks.
BR Stefan
Hi Stefan,
The Cubit command language doesn’t have a method to create a brick based on the corners. If I really wanted this in python, I would create a function. Here is an example just using the length, width, and height specified as x, y, and z values.
def my_brick(x, y, z, center): cubit.cmd("graphics off") brick = cubit.brick(x, y, z) cubit.move(brick, center) cubit.cmd("graphics on")
It would be used as follows
import random for i in range(10): random_x = random.randint(1,10) random_y = random.randint(1,10) random_z = random.randint(1,10) my_brick(random_x/2,random_y/2,random_z/3, [random_x, random_y, random_z])
I turned graphics off and back on to reduce any graphics flashing while creating and moving the objects. That is not necessary, but can be nice. Converting from x, y, and z lengths to distances between the given coordinates should be fairly straight forward.
Karl
Hello Karl,
many thanks for the information - I will proceed with your suggested solution.
BR Stefan