Blocks Operations

Multi Transformation

import geompy

import salome

gg = salome.ImportComponentGUI("GEOM")

 

# create vertices

p_25_25_50 = geompy.MakeVertex(25., 25., 50.)

p_50_25_25 = geompy.MakeVertex(50., 25., 25.)

p_25_50_25 = geompy.MakeVertex(25., 50., 25.)

box = geompy.MakeBoxDXDYDZ(50, 50, 50)

top_face = geompy.GetFaceNearPoint(box, p_25_25_50)

yz_face = geompy.GetFaceNearPoint(box, p_50_25_25)

xz_face = geompy.GetFaceNearPoint(box, p_25_50_25)

top_face_ind = geompy.LocalOp.GetSubShapeIndex(box, top_face)

yz_face_ind = geompy.LocalOp.GetSubShapeIndex(box, yz_face)

xz_face_ind = geompy.LocalOp.GetSubShapeIndex(box, xz_face)

 

# Multi-transformate block and glue the result

box_tr1 = geompy.MakeMultiTransformation1D(box, yz_face_ind, top_face_ind, 3)

box_tr2 = geompy.MakeMultiTransformation2D(box, xz_face_ind, yz_face_ind, 3, top_face_ind, 0, 2)

 

# add objects in the study

id_box = geompy.addToStudy(box, "Box")

id_box_tr1 = geompy.addToStudy(box_tr1, "Multi-transformed Block 1D")

id_box_tr2 = geompy.addToStudy(box_tr2, "Multi-transformed Block 2D")

 

# display the results

gg.createAndDisplayGO(id_box)

gg.setDisplayMode(id_box,1)

gg.createAndDisplayGO(id_box_tr1)

gg.createAndDisplayGO(id_box_tr2)

 

Explode on Blocks

import geompy

import salome

gg = salome.ImportComponentGUI("GEOM")

 

# create a box and a sphere

box = geompy.MakeBoxDXDYDZ(200, 200, 200)

sphere = geompy.MakeSphereR(100)

 

# make a compound

compound = geompy.MakeCompound([box, sphere])

 

# get all the blocks, contained in the given compound

make_block_explode = geompy.MakeBlockExplode(compound, 1, 1)

 

# add objects in the study

id_compound = geompy.addToStudy(compound, "Compound")

id_make_block_explode = geompy.addToStudy(make_block_explode[0], "MakeBlockExplode")

 

# display the results

gg.createAndDisplayGO(id_compound)

gg.createAndDisplayGO(id_make_block_explode)

gg.setDisplayMode(id_make_block_explode,1)

 

Propagate

import geompy

import salome

 

# create a box and a sphere

box = geompy.MakeBoxDXDYDZ(200, 200, 200)

 

# check and improve

check_box = geompy.CheckAndImprove(box)

  

# build all possible propagation groups

listChains = geompy.Propagate(check_box)

 

# add objects in the study

geompy.addToStudy(check_box, "Box")

for chain in listChains:

    geompy.addToStudyInFather(check_box, chain, "propagation chain")

salome.sg.updateObjBrowser(1)