Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setup.source.center = False
setup.source.scale_to_size = False
#testing.add_point_attributes_test(setup, True, True, 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 = "centermidpoints"
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_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.SubdivideFaces.CenterMidpoints", 1)
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
#testing.add_point_attributes_test(setup, True, True, 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 = "centermidpoints"
testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
#testing.require_valid_point_attributes(setup.document, setup.modifier.output_mesh)
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
#testing.add_point_attributes_test(setup, True, True, 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 = "centermidpoints"
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_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.SubdivideFaces.CenterMidpoints", 1)
#python
import testing
import k3d
setup = testing.setup_mesh_modifier_test("NurbsCircle", "NurbsCloseCurve")
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.NurbsCloseCurve2", 32, ["Darwin-i386"])
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
#testing.add_point_attributes_test(setup, True, True, 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 = "centermidpoints"
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_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.SubdivideFaces.CenterMidpoints", 1)
#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)
#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"])
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 = "center"
testing.require_valid_primitives(setup.document, setup.modifier.get_property("output_mesh"))
testing.mesh_reference_comparison(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.SubdivideFaces.Center", 1)
selection = k3d.selection.set()
primitive_selection = k3d.geometry.primitive_selection.create(selection, k3d.selection.type.EDGE)
k3d.geometry.primitive_selection.append(primitive_selection, 10, 11, 1)
k3d.geometry.primitive_selection.append(primitive_selection, 28, 29, 1)
k3d.geometry.primitive_selection.append(primitive_selection, 30, 31, 1)
k3d.geometry.primitive_selection.append(primitive_selection, 48, 49, 1)
k3d.geometry.primitive_selection.append(primitive_selection, 48, 49, 1)
k3d.geometry.primitive_selection.append(primitive_selection, 50, 51, 1)
k3d.geometry.primitive_selection.append(primitive_selection, 68, 69, 1)
k3d.geometry.primitive_selection.append(primitive_selection, 70, 71, 1)
k3d.geometry.primitive_selection.append(primitive_selection, 88, 89, 1)
k3d.geometry.primitive_selection.append(primitive_selection, 90, 91, 1)
k3d.geometry.primitive_selection.append(primitive_selection, 43, 44, 1)
k3d.geometry.primitive_selection.append(primitive_selection, 18, 19, 1)
k3d.geometry.primitive_selection.append(primitive_selection, 36, 37, 1)
k3d.geometry.primitive_selection.append(primitive_selection, 82, 83, 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.CollapseEdges", 2)
setup.source.center = False
setup.source.scale_to_size = False
selection = k3d.geometry.selection.create(0)
point_selection = k3d.geometry.point_selection.create(selection)
k3d.geometry.point_selection.append(point_selection, 0, 10000, 0)
k3d.geometry.point_selection.append(point_selection, 7, 8, 1)
face_selection = k3d.geometry.primitive_selection.create(selection, k3d.selection.type.FACE)
k3d.geometry.primitive_selection.append(face_selection, 0, 10000, 0)
k3d.geometry.primitive_selection.append(face_selection, 6, 7, 1)
k3d.geometry.primitive_selection.append(face_selection, 8, 9, 1)
k3d.geometry.primitive_selection.append(face_selection, 13, 15, 1)
k3d.geometry.primitive_selection.append(face_selection, 16, 17, 1)
k3d.geometry.primitive_selection.append(face_selection, 19, 20, 1)
edge_selection = k3d.geometry.primitive_selection.create(selection, k3d.selection.type.EDGE)
k3d.geometry.primitive_selection.append(edge_selection, 0, 10000, 0)
k3d.geometry.primitive_selection.append(edge_selection, 25, 26, 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.DeleteComponents.complex", 1)