示例#1
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCube", "BevelFaces")

selection = k3d.geometry.selection.create(0)
selection.faces = [(4, 5, 1)]
setup.modifier.mesh_selection = selection

testing.require_valid_mesh(setup.document,
                           setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document,
                             setup.modifier.get_property("output_mesh"),
                             "mesh.modifier.BevelFaces", 1)
示例#2
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("FrozenMesh", "TriangulateFaces")

mesh = setup.source.create_mesh()

positions = [(-5, 5, 0), (5, 5, 0), (-5, -5, 0), (5, -5, 0)]

points = mesh.create_points()
point_selection = mesh.create_point_selection()

for position in positions:
    points.append(k3d.point3(position[0], position[1], position[2]))
    point_selection.append(0.0)

polyhedron = k3d.polyhedron.create(mesh)
polyhedron.shell_types().append(k3d.polyhedron.shell_type.POLYGONS)
polyhedron.face_shells().append(0)
polyhedron.face_first_loops().append(0)
polyhedron.face_loop_counts().append(1)
polyhedron.face_materials().append(None)
polyhedron.face_selections().append(0.0)
polyhedron.loop_first_edges().append(0)
polyhedron.clockwise_edges().assign([1, 2, 3, 0])
polyhedron.edge_selections().assign([0, 0, 0, 0])
polyhedron.vertex_points().assign([0, 1, 2, 3])
polyhedron.vertex_selections().assign([0, 0, 0, 0])
#python

import testing
import k3d

setup = testing.setup_mesh_modifier_test("NurbsCircle", "NurbsCurveInsertKnot")

setup.modifier.u_value = 0.1

selection = k3d.geometry.selection.create(0)
curve_selection = k3d.geometry.primitive_selection.create(selection, k3d.selection.type.CURVE)
k3d.geometry.primitive_selection.append(curve_selection, 0, 10000, 1)
setup.modifier.mesh_selection = selection

testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.NurbsCurveInsertKnot", 2, ["Darwin-i386"])

示例#4
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyGrid", "CollapseFaces")

selection = k3d.selection.set()
primitive_selection = k3d.geometry.primitive_selection.create(selection, k3d.selection.type.FACE)
k3d.geometry.primitive_selection.append(primitive_selection, 0, 1, 1)
k3d.geometry.primitive_selection.append(primitive_selection, 13, 14, 1)
k3d.geometry.primitive_selection.append(primitive_selection, 17, 18, 1)
k3d.geometry.primitive_selection.append(primitive_selection, 19, 20, 1)
k3d.geometry.primitive_selection.append(primitive_selection, 23, 24, 1)

setup.modifier.mesh_selection = selection

testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.CollapseFaces", 2)

示例#5
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCube", "MeshArray2D")

setup.modifier.layout = k3d.plugin.create("TranslateArray2D", setup.document)

testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.MeshArray2D", 1)

#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolySphere", "DeformationExpression")

selection = k3d.geometry.selection.create(0)
selection.points = k3d.geometry.point_selection.create(selection, 1)
setup.modifier.mesh_selection = selection

testing.require_valid_mesh(setup.document,
                           setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document,
                             setup.modifier.get_property("output_mesh"),
                             "mesh.modifier.DeformationExpression", 32,
                             ["Darwin-i386"])
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("NurbsCircle","NurbsPolygonizeCurve")

setup.modifier.mesh_selection = k3d.geometry.selection.create(1)
setup.modifier.segments = 10
setup.modifier.delete_original = True


testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.NurbsPolygonizeCurve", 3, ["Darwin-i386"])

示例#8
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCube", "EdgesToBlobby")

testing.mesh_comparison_to_reference(
    setup.document, setup.modifier.get_property("output_mesh"),
    "mesh.modifier.EdgesToBlobby", 1)
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCube", "CUDATransformPoints")

selection = k3d.geometry.selection.create(0)
selection.points = k3d.geometry.point_selection.uniform(selection, 1)

setup.modifier.mesh_selection = selection
setup.modifier.input_matrix = k3d.translate3(k3d.vector3(0, 0, 1))


testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.TransformPoints", 1)
示例#10
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyGrid", "ScalePoints")

setup.source.rows = 1
setup.source.columns = 1

mesh_selection = k3d.geometry.selection.create(1.0)
setup.modifier.mesh_selection = mesh_selection
setup.modifier.x = 2

testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.selection.all", 1)

示例#11
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyText", "CapHoles")

selection = k3d.geometry.selection.create(0)
edge_selection = k3d.geometry.primitive_selection.create(selection, k3d.selection.type.EDGE)
k3d.geometry.primitive_selection.append(edge_selection, 48, 49, 1)

setup.source.text = "8"
setup.modifier.mesh_selection = selection

testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.CapHoles", 2, ["Darwin-i386"])

#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCube", "PointsToParticles")


testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.PointsToParticles", 1)

#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyGrid", "SelectBoundaryEdges")
setup.modifier.mesh_selection = k3d.geometry.selection.create(0)


testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.selection.SelectBoundaryEdges", 1)

# python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCylinder", "LinearWavePoints")

selection = k3d.geometry.selection.create(0)
selection.points = k3d.geometry.point_selection.create(selection, 1)

setup.source.u_segments = 4
setup.source.v_segments = 16

setup.modifier.mesh_selection = selection
setup.modifier.axis = "x"
setup.modifier.along = "z"

testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(
    setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.LinearWavePoints", 1, ["Darwin-i386"]
)
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("FrozenMesh", "TriangulateFaces")

mesh = setup.source.create_mesh()

points = mesh.create_points()
point_selection = mesh.create_point_selection()

polyhedron = k3d.polyhedron.create(mesh)
Cs = polyhedron.vertex_attributes().create("Cs", "k3d::color")

positions = [(0, 0, 1), (1, 0, 1), (2, 0, 0), (2, 0, 1), (1, 0, 0), (0, 0, 0)]
for position in positions:
	points.append(k3d.point3(position[0], position[1], position[2]))
	point_selection.append(0)

polyhedron.shell_types().append(k3d.polyhedron.shell_type.POLYGONS)

polyhedron.face_shells().append(0)
polyhedron.face_first_loops().append(len(polyhedron.loop_first_edges()))
polyhedron.face_loop_counts().append(1)
polyhedron.face_materials().append(None)
polyhedron.face_selections().append(0)

polyhedron.loop_first_edges().append(len(polyhedron.clockwise_edges()))

polyhedron.clockwise_edges().append(1)
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCylinder", "TaperPoints")

selection = k3d.geometry.selection.create(0)
selection.points = k3d.geometry.point_selection.create(selection, 1)

setup.modifier.mesh_selection = selection
setup.modifier.taper_factor = 1

testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.TaperPoints", 4, ["Darwin-i386"])

# python

import k3d
import testing
import benchmarking

setup = testing.setup_mesh_modifier_test("PolySphere", "CatmullClark")
setup.modifier.level = 5

setup.modifier.mesh_selection = k3d.geometry.selection.create(1)

profiler = k3d.plugin.create("PipelineProfiler", setup.document)

testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
# note: no comparison to reference, as the file is 97 MB!

benchmarking.print_profiler_records(profiler.records)
print """<DartMeasurement name="Total Time" type="numeric/float">""" + str(
    benchmarking.total_profiler_time(profiler.records)
) + """</DartMeasurement>"""
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("NurbsCurve",
                                         "NurbsCurveDegreeElevation")

mesh_selection = k3d.geometry.selection.create(0)
uniform_selection = k3d.geometry.primitive_selection.create(
    mesh_selection, k3d.selection.type.CURVE)
k3d.geometry.primitive_selection.append(uniform_selection, 1)

setup.modifier.mesh_selection = mesh_selection
setup.modifier.degree = 1

testing.require_valid_mesh(setup.document,
                           setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document,
                             setup.modifier.get_property("output_mesh"),
                             "mesh.modifier.NurbsDegreeElevateCurve", 1)
示例#19
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("K3DMeshReader", "BridgeEdges")
setup.source.file = k3d.filesystem.generic_path(testing.source_path() + "/meshes/mesh.modifier.BridgeEdges.source.k3d")

selection = k3d.geometry.selection.create(0)
edge_selection = k3d.geometry.primitive_selection.create(selection, k3d.selection.type.EDGE)
k3d.geometry.primitive_selection.append(edge_selection, 1, 2, 1)
k3d.geometry.primitive_selection.append(edge_selection, 7, 8, 1)

setup.modifier.mesh_selection = selection


testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.BridgeEdges", 1)

#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyGrid", "ExtrudeFaces")

setup.source.rows = 3
setup.source.columns = 3

selection = k3d.geometry.selection.create(0)
face_selection = k3d.geometry.primitive_selection.create(selection, k3d.selection.type.FACE)
k3d.geometry.primitive_selection.append(face_selection, 4, 5, 1)
setup.modifier.mesh_selection = selection
setup.modifier.distance = 5


testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.ExtrudeFaces", 2)

示例#21
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyGrid", "ExtrudeFaces")

setup.source.rows = 3
setup.source.columns = 3

selection = k3d.geometry.selection.create(0)
face_selection = k3d.geometry.primitive_selection.create(
    selection, k3d.selection.type.FACE)
k3d.geometry.primitive_selection.append(face_selection, 4, 5, 1)
setup.modifier.mesh_selection = selection
setup.modifier.distance = 5

testing.require_valid_mesh(setup.document,
                           setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document,
                             setup.modifier.get_property("output_mesh"),
                             "mesh.modifier.ExtrudeFaces", 2)
示例#22
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("NurbsGrid", "NurbsSplitPatch")

setup.modifier.mesh_selection = k3d.geometry.selection.create(1)
setup.modifier.u_value = 0.147
setup.modifier.insert_to_v = True

testing.require_valid_mesh(setup.document,
                           setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document,
                             setup.modifier.get_property("output_mesh"),
                             "mesh.modifier.NurbsSplitPatch2", 16)
示例#23
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCube", "BevelPoints")

selection = k3d.mesh_selection.deselect_all()
selection.points = k3d.mesh_selection.component_select_all()
setup.modifier.mesh_selection = selection

testing.mesh_comparison_to_reference(
    setup.document, setup.modifier.get_property("output_mesh"),
    "mesh.modifier.BevelPoints", 1)
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyGrid", "GrowSelection")

selection = k3d.geometry.selection.create(0)

point_selection = k3d.geometry.point_selection.create(selection)
k3d.geometry.point_selection.append(point_selection, 15, 16, 1)
k3d.geometry.point_selection.append(point_selection, 18, 19, 1)

edge_selection = k3d.geometry.primitive_selection.create(selection, k3d.selection.type.EDGE)
k3d.geometry.primitive_selection.append(edge_selection, 17, 18, 1)
k3d.geometry.primitive_selection.append(edge_selection, 55, 56, 1)

face_selection = k3d.geometry.primitive_selection.create(selection, k3d.selection.type.FACE)
k3d.geometry.primitive_selection.append(face_selection, 12, 13, 1)

setup.modifier.mesh_selection = selection

testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.selection.GrowSelection", 2)

#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("K3DMeshReader", "SubdivideEdges")
setup.source.file = k3d.filesystem.generic_path(testing.source_path() + "/meshes/polyhedron.hole.k3d")
setup.source.center = False
setup.source.scale_to_size = False

selection = k3d.geometry.selection.create(0)
edge_selection = k3d.geometry.primitive_selection.create(selection, k3d.selection.type.EDGE)
k3d.geometry.primitive_selection.append(edge_selection, 0, 4294967295, 0)
k3d.geometry.primitive_selection.append(edge_selection, 0, 4, 1)
k3d.geometry.primitive_selection.append(edge_selection, 27, 28, 1)
k3d.geometry.primitive_selection.append(edge_selection, 52, 65, 1)
k3d.geometry.primitive_selection.append(edge_selection, 74, 82, 1)
setup.modifier.mesh_selection = selection
setup.modifier.vertices = 2

testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.SubdivideEdges", 8)

示例#26
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyGrid", "DissolveFaces")

selection = k3d.selection.set()
primitive_selection = k3d.geometry.primitive_selection.create(selection, k3d.selection.type.FACE)
k3d.geometry.primitive_selection.append(primitive_selection, 0, 2, 1)
k3d.geometry.primitive_selection.append(primitive_selection, 11, 15, 1)

setup.modifier.mesh_selection = selection

testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "modifier.DissolveFaces", 2)

示例#27
0
#python

import testing
import k3d

setup = testing.setup_mesh_modifier_test("NurbsCircle", "NurbsFlipCurve")
setup.modifier.mesh_selection = k3d.geometry.selection.create(1)

testing.require_valid_mesh(setup.document,
                           setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document,
                             setup.modifier.get_property("output_mesh"),
                             "mesh.modifier.NurbsFlipCurve", 1,
                             ["Darwin-i386"])
示例#28
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCube", "SDSHole")

selection = k3d.geometry.selection.create(0)
face_selection = k3d.geometry.primitive_selection.create(selection)
face_selection.primitive_begin().append(0)
face_selection.primitive_end().append(1)
face_selection.primitive_selection_type().append(k3d.selection.type.FACE)
face_selection.primitive_first_range().append(0)
face_selection.primitive_range_count().append(1)
face_selection.index_begin().append(3)
face_selection.index_end().append(4)
face_selection.weight().append(1)

setup.modifier.mesh_selection = selection

testing.require_valid_mesh(setup.document,
                           setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document,
                             setup.modifier.get_property("output_mesh"),
                             "mesh.modifier.SDSHole", 1)
示例#29
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCylinder", "LinearWavePoints")

selection = k3d.mesh_selection.deselect_all()
selection.points = k3d.mesh_selection.component_select_all()

setup.source.u_segments = 4
setup.source.v_segments = 16

setup.modifier.mesh_selection = selection
setup.modifier.axis = "x"
setup.modifier.along = "z"

testing.mesh_comparison_to_reference(
    setup.document, setup.modifier.get_property("output_mesh"),
    "mesh.modifier.LinearWavePoints", 0)
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCube", "ConnectVertices")

selection = k3d.selection.set()
point_selection = k3d.geometry.point_selection.create(selection)
k3d.geometry.point_selection.append(point_selection, 0, 1, 1)
k3d.geometry.point_selection.append(point_selection, 2, 3, 1)

setup.modifier.mesh_selection = selection


testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.ConnectVertices", 1)

#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("NurbsCircle","NurbsEditCurveKnotVector")

selection = k3d.geometry.selection.create(0)
curve_selection = k3d.geometry.primitive_selection.create(selection, k3d.selection.type.CURVE)
k3d.geometry.primitive_selection.append(curve_selection, 0, 10000, 1)
setup.modifier.mesh_selection = selection

setup.modifier.knot_vector = [0, 0, 0, 0.1, 0.2, 0.25, 0.3, 0.3, 0.8, 0.8, 1, 1, 1]

testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.NurbsEditKnotVector", 1, ["Darwin-i386"])

#python

import testing
import k3d

setup = testing.setup_mesh_modifier_test("NurbsCircle","NurbsExtrudeCurve")
setup.modifier.mesh_selection = k3d.geometry.selection.create(1)

testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.NurbsExtrudeCurve", 1, ["Darwin-i386"])

示例#33
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyGrid", "CatmullClark")
testing.add_point_attributes_test(setup, True, False, False)

setup.source.u_segments = 4
setup.source.v_segments = 2
setup.source.bottom = False

setup.modifier.mesh_selection = k3d.geometry.selection.create(1)

testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
#testing.require_valid_point_attributes(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.CatmullClark", 2)

#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCube", "PolyToBilinear")


testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.PolyToBilinear", 1)

#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCube", "RotatePoints")

selection = k3d.geometry.selection.create(0)
selection.points = k3d.geometry.point_selection.create(selection, 1)

setup.modifier.mesh_selection = selection
setup.modifier.z = 1.0


testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.RotatePoints", 1)

#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCube", "TriangulateFaces")

mesh_selection = k3d.geometry.selection.create(1)
setup.modifier.mesh_selection = mesh_selection


testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.TriangulateFaces.PolyCube", 0)

示例#37
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCube", "ShearPoints")

selection = k3d.geometry.selection.create(0)
selection.points = k3d.geometry.point_selection.create(selection, 1)

setup.modifier.mesh_selection = selection
setup.modifier.shear_factor = 1.0


testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.ShearPoints", 1)

示例#38
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("K3DMeshReader", "SubdivideFaces")

# load a mesh that has multiple polyhedra, triangles, quads, n-sided polygons and holes. (i.e. a mesh from hell)
setup.source.file = k3d.filesystem.generic_path(testing.source_path() +
                                                "/meshes/polyhedron.hole.k3d")
setup.source.center = False
setup.source.scale_to_size = False

# select some faces, distributed along polyhedra
selection = k3d.geometry.selection.create(0)
face_selection = k3d.geometry.primitive_selection.create(
    selection, k3d.selection.type.FACE)
k3d.geometry.primitive_selection.append(face_selection, 0, 6, 0)
k3d.geometry.primitive_selection.append(face_selection, 6, 7, 1)
k3d.geometry.primitive_selection.append(face_selection, 7, 8, 0)
k3d.geometry.primitive_selection.append(face_selection, 8, 9, 1)
k3d.geometry.primitive_selection.append(face_selection, 9, 13, 0)
k3d.geometry.primitive_selection.append(face_selection, 13, 15, 1)
k3d.geometry.primitive_selection.append(face_selection, 15, 16, 0)
k3d.geometry.primitive_selection.append(face_selection, 16, 17, 1)
k3d.geometry.primitive_selection.append(face_selection, 17, 19, 0)
k3d.geometry.primitive_selection.append(face_selection, 19, 20, 1)
k3d.geometry.primitive_selection.append(face_selection, 20, 23, 0)

setup.modifier.mesh_selection = selection
setup.modifier.subdivision_type = "midpoints"
#python

import testing
import k3d

setup = testing.setup_mesh_modifier_test("NurbsCircle",
                                         "NurbsExtractCurvePoint")

setup.modifier.parameter = 0.1

setup.modifier.mesh_selection = k3d.geometry.selection.create(1)

testing.require_valid_mesh(setup.document,
                           setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document,
                             setup.modifier.get_property("output_mesh"),
                             "mesh.modifier.NurbsExtractCurvePoint", 1)
# python

import testing
import k3d

setup = testing.setup_mesh_modifier_test("NurbsDisk", "NurbsExtrudePatch")
setup.modifier.mesh_selection = k3d.geometry.selection.create(1)

testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(
    setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.NurbsExtrudePatch", 2, ["Darwin-i386"]
)
示例#41
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCylinder", "BulgePoints")

setup.source.radius = 1

selection = k3d.mesh_selection.deselect_all()
selection.points = k3d.mesh_selection.component_select_all()

setup.modifier.mesh_selection = selection
setup.modifier.bulge_factor = 5
setup.modifier.displace_y = False
setup.modifier.displace_z = False

testing.mesh_comparison_to_reference(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.BulgePoints", 2)

示例#42
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyGrid", "EulerKillEdgeMakeLoop")

setup.source.rows = 3
setup.source.columns = 3

selection = k3d.mesh_selection.deselect_all()
selection.edges = [(0, 4294967295, 0), (7, 8, 1), (1, 2, 1), (2, 3, 1),
                   (12, 13, 1), (14, 15, 1), (24, 25, 1), (31, 32, 1),
                   (25, 26, 1), (35, 36, 1), (29, 30, 1), (22, 23, 1),
                   (32, 33, 1), (10, 11, 1), (20, 21, 1), (5, 6, 1),
                   (11, 12, 1)]

setup.modifier.mesh_selection = selection

testing.mesh_comparison_to_reference(
    setup.document, setup.modifier.get_property("output_mesh"),
    "mesh.modifier.EulerKillEdgeMakeLoop", 1)
示例#43
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyGrid", "SetColor")
setup.modifier.mesh_selection = k3d.geometry.selection.create(1)


testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.SetColor", 1)

示例#44
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCylinder", "TaperPoints")

selection = k3d.geometry.selection.create(0)
selection.points = k3d.geometry.point_selection.create(selection, 1)

setup.modifier.mesh_selection = selection
setup.modifier.taper_factor = 1

testing.require_valid_mesh(setup.document,
                           setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document,
                             setup.modifier.get_property("output_mesh"),
                             "mesh.modifier.TaperPoints", 4, ["Darwin-i386"])
# python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCube", "SphereizePoints")

setup.source.rows = 2
setup.source.columns = 2
setup.source.slices = 2

selection = k3d.geometry.selection.create(0)
selection.points = k3d.geometry.point_selection.create(selection, 1)

setup.modifier.mesh_selection = selection


testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(
    setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.SphereizePoints", 1
)
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCube", "GTSMeshVolume")
setup.source.width = 2
setup.source.height = 3
setup.source.depth = 4

testing.require_mesh_volume(setup.modifier.volume, 24.0)

示例#47
0
#python

import testing
import k3d

document = k3d.new_document()
setup = testing.setup_mesh_modifier_test("NurbsDisk", "NurbsExtrudePatch")
setup.modifier.mesh_selection = k3d.mesh_selection.select_all()

testing.mesh_comparison_to_reference(document, setup.modifier.get_property("output_mesh"), "mesh.modifier.NurbsExtrudePatch", 1)

示例#48
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("NurbsCurve","NurbsSplitCurve")
testing.add_point_attributes_test(setup, True, True, True)

selection = k3d.geometry.selection.create(0)
curve_selection = k3d.geometry.primitive_selection.create(selection, k3d.selection.type.CURVE)
k3d.geometry.primitive_selection.append(curve_selection, 0, 10000, 1)
setup.modifier.mesh_selection = selection

testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
#testing.require_valid_point_attributes(setup.document, setup.modifier.output_mesh)
#testing.require_valid_vertex_attributes(setup.document, setup.modifier.output_mesh)
#testing.require_valid_parameter_attributes(setup.document, setup.modifier.output_mesh)
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.NurbsSplitCurve", 1)

示例#49
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCube", "SmoothPoints")

setup.source.rows = 2
setup.source.columns = 2
setup.source.slices = 2

selection = k3d.mesh_selection.deselect_all()
selection.points = k3d.mesh_selection.component_select_all()

setup.modifier.mesh_selection = selection

testing.mesh_comparison_to_reference(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.SmoothPoints", 1)

示例#50
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyGrid", "ScalePoints")

setup.source.rows = 1
setup.source.columns = 1

mesh_selection = k3d.geometry.selection.create(0.0)
setup.modifier.mesh_selection = mesh_selection
setup.modifier.x = 2

testing.require_valid_mesh(setup.document,
                           setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document,
                             setup.modifier.get_property("output_mesh"),
                             "mesh.selection.none", 1)
示例#51
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyGrid", "EulerKillEdgeAndVertex")

selection = k3d.mesh_selection.deselect_all()
selection.edges = [(0, 4294967295, 0), (49, 50, 1), (55, 56, 1)]

setup.modifier.mesh_selection = selection

testing.mesh_comparison_to_reference(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.EulerKillEdgeAndVertex", 1)

示例#52
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCube", "TransformPoints")

selection = k3d.mesh_selection.deselect_all()
selection.points = k3d.mesh_selection.component_select_all()

setup.modifier.mesh_selection = selection
setup.modifier.input_matrix = k3d.translate3(k3d.vector3(0, 0, 1))

testing.mesh_comparison_to_reference(
    setup.document, setup.modifier.get_property("output_mesh"),
    "mesh.modifier.TransformPoints", 1)
#python

import testing
import k3d

setup = testing.setup_mesh_modifier_test("NurbsCircle","NurbsSetWeight")

modifier = setup.modifier
modifier.weight = 1.7
modifier.mesh_selection = k3d.geometry.selection.create(1)

testing.require_valid_mesh(setup.document, modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, modifier.get_property("output_mesh"), "mesh.modifier.NurbsSetWeight1", 1, ["Darwin-i386"])