Beispiel #1
0
cmd = ("partition  ", "<inputDir> <outputDir>",
       "Automatic partitioning of a mesh, based on feature edges")
parser = OptionParser(usage="amibebatch %s [OPTIONS] %s\n\n%s" % cmd,
                      prog="report")
parser.add_option(
    "-c",
    "--coplanarity",
    metavar="FLOAT",
    default=0.95,
    action="store",
    type="float",
    dest="coplanarity",
    help=
    "minimum dot product of face normals when building feature edges (default 0.95)"
)

(options, args) = parser.parse_args(args=sys.argv[1:])

if len(args) != 2:
    parser.print_usage()
    sys.exit(1)

xmlDir = args[0]
outDir = args[1]

mesh = Mesh()
MeshReader.readObject3D(mesh, xmlDir)
mesh.buildRidges(options.coplanarity)
mesh.buildPartition()
MeshWriter.writeObject3D(mesh, outDir, String())
Beispiel #2
0
(options, args) = parser.parse_args(args=sys.argv[1:])

if len(args) != 2:
    parser.print_usage()
    sys.exit(1)

xmlDir = args[0]
outDir = args[1]

# Original mesh will be treated as a background mesh
background_mtb = MeshTraitsBuilder.getDefault3D()
background_mtb.addNodeSet()
background_mesh = Mesh(background_mtb)
MeshReader.readObject3D(background_mesh, xmlDir)
if options.coplanarity:
    background_mesh.buildRidges(options.coplanarity)

# New mesh must not have connectivity
new_mtb = MeshTraitsBuilder()
new_mtb.addTriangleList()
new_mtb.addNodeList()
new_mesh = Mesh(new_mtb)

for point in background_mesh.getNodes():
    new_mesh.add(point)

# Split triangles into 4 new triangles
mapSeenTriangles = {}
for triangle in background_mesh.getTriangles():
    if triangle.hasAttributes(AbstractHalfEdge.OUTER): continue
    edge = triangle.getAbstractHalfEdge()
Beispiel #3
0
(options, args) = parser.parse_args(args=sys.argv[1:])

if len(args) != 2:
	parser.print_usage()
	sys.exit(1)

xmlDir = args[0]
outDir = args[1]

# Original mesh will be treated as a background mesh
background_mtb = MeshTraitsBuilder.getDefault3D()
background_mtb.addNodeSet()
background_mesh = Mesh(background_mtb)
MeshReader.readObject3D(background_mesh, xmlDir)
if options.coplanarity:
	background_mesh.buildRidges(options.coplanarity)

# New mesh must not have connectivity
new_mtb = MeshTraitsBuilder()
new_mtb.addTriangleList()
new_mtb.addNodeList()
new_mesh = Mesh(new_mtb)

for point in background_mesh.getNodes():
	new_mesh.add(point)

# Split triangles into 4 new triangles
mapSeenTriangles = {}
for triangle in background_mesh.getTriangles():
	if triangle.hasAttributes(AbstractHalfEdge.OUTER): continue
	edge = triangle.getAbstractHalfEdge()
Beispiel #4
0
# Python
import sys, os
from optparse import OptionParser

"""
   Automatic partitioning of a mesh, based on feature edges
"""

cmd=("partition  ", "<inputDir> <outputDir>", "Automatic partitioning of a mesh, based on feature edges")
parser = OptionParser(usage="amibebatch %s [OPTIONS] %s\n\n%s" % cmd,
	prog="report")
parser.add_option("-c", "--coplanarity", metavar="FLOAT", default=0.95,
                  action="store", type="float", dest="coplanarity",
		  help="minimum dot product of face normals when building feature edges (default 0.95)")

(options, args) = parser.parse_args(args=sys.argv[1:])

if len(args) != 2:
	parser.print_usage()
	sys.exit(1)

xmlDir = args[0]
outDir = args[1]

mesh = Mesh()
MeshReader.readObject3D(mesh, xmlDir)
mesh.buildRidges(options.coplanarity)
mesh.buildPartition()
MeshWriter.writeObject3D(mesh, outDir, String())