Creating a solid from surfaces

Hi there! Is there any way to create a solid from several surfaces using the Test Harness commands? I suppose first I need to define a shell with the different surfaces that enclose the solid, and then use it to create the volume, but I don't know how to do that... Any help?

Thanks in advance

Paul Jimenez's picture

Hi,

You may get some ideas on how to build something by checking the bottle example at http://www.opencascade.org/org/gettingstarted/appli/

That example does not use the test harness, so you would have to translate all commands to those of DRAWEXE.

Just in case, what kind of surfaces do you want to use? I've mostly used planar surfaces everywhere and it's indeed possible, yet it's quite a lengthy and boring process to do so (both using the Test Harness and the API directly). In such a case you would have to define the vertices, edges, wires and faces being aware of what's shared to be able to build the shell correctly, then you can create a solid from the shell. The process should be similar for non-planar surfaces, but it would most likely require a few more commands to connect the faces the right way.

I suggest you to check chapter 6 and 7 of the Test Harness documentation for all commands that deal with geometry and topology.

fjapesol's picture

For the moment I am interested in planar surfaces, and I already have defined the edges and surfaces I need. I have everything I need for composing the solid just ready to do so, but I don't find the command for creating the shell in the Test Harness documentation.

Paul Jimenez's picture

I gave you the command in a previous post: sewing

Feed 'sewing' with all the faces and you'll get a shell.

fjapesol's picture

Ok, I was using instinctively the sewing command without knowing that I was obtaining a shell with it.

Anyway, this doesn't solve my problem. Let us suppose I want to mesh a 'simple' structure, a microstrip line. For this, I need a substrate block (volume) fused with a stripline (surface) on the top. If I just build a box and a plane surface, and sew them, or make a compound with them, the resulting geometry contains both objects, but as if they were independent non-related structures. Thus, if I load the geometry with a mesher, i.e. gmsh, when I do the meshing I obtain independent meses for the substrate and the strip, without connectivities between the nodes in the interface. In order to respect the correct connectivity between the two objects, I need to fuse the top surface of the substrate block, and the strip surface. Then, the top surface is meshed correctly, but I lost the solid object (and I want to obtain the proper solid with the proper well-meshed surface on the top). Here I show you a sample code:

pload ALL

# Set dimensions
dset adiel 40.0E-3
dset bdiel 40.0E-3
dset cdiel 1.0E-3
dset wstrip 1.5E-3
dset lstrip $bdiel

# Defining Strip
#all vertices of the wire
vertex v1 0 0 0
vertex v2 0 lstrip 0
vertex v3 wstrip lstrip 0
vertex v4 wstrip 0 0
#linear segments
edge e1 v1 v2
edge e2 v2 v3
edge e3 v3 v4
edge e4 v1 v4
# Wire
wire stripwire e1 e2 e3 e4
# Surface
mkplane strip stripwire
# Translation of the surface
ttranslate strip adiel/2-wstrip/2 0 cdiel

# Defining the substrate box
box substrate adiel bdiel cdiel

# Fusing strip with substrate top
explode substrate f
bop substrate_6 strip
bopfuse stripinsubs

#Creating a shell with the desired surfaces
sewing subsbound stripinsubs substrate_1 substrate_2 substrate_3 substrate_4 substrate_5

#Creating the final compound substrate + strip
compound substrate subsbound substratestrip
sewing substratestrip2 substrate subsbound
add subsbound substrate

Using ANY of the last three commands I obtain the same, A BOX PLUS A SHELL, INSTEAD OF A BOX FUSED WITH A SHELL, and when loading with gmsh (for this I export the geometry as a .brep file) they are treated as separated objects with independent meshes, without respecting the connectivities between the strip and substrate top in the case of the box (this connectivities are ok for the shell object, but I want this shell to be also a solid with inner volume meshing). This is where my problem is.

Paul Jimenez's picture

I do not fully get what you are trying to do, but see if it's more like this:

...

# Defining the substrate box
box substrate adiel bdiel cdiel

### new code ###

# Extract shell from the box
explode substrate sh

# Fuse the box's shell with the strip
bop substrate_1 strip
bopfuse result

# Extract the resulting shell from the compound generated by fuse
explode result

# Build a solid from the shell
mksol sol result_1