Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#python
import testing
import k3d
setup = testing.setup_mesh_modifier_test("NurbsCurve", "NurbsCloseCurve")
setup.modifier.keep_ends = 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_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.NurbsCloseCurve1", 1)
#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)
#python
import k3d
import testing
setup = testing.setup_mesh_modifier_test("PolyCube", "MoveFirstEdge")
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(0)
face_selection.index_end().append(3)
face_selection.weight().append(1)
setup.modifier.mesh_selection = selection
setup.modifier.distance = 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.MoveFirstEdge", 1)
#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("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)
#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("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 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"])
import testing
setup = testing.setup_mesh_modifier_test("PolyGrid", "CollapseEdges")
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)
merge_mesh = k3d.plugin.create("MergeMesh", document)
modifier = k3d.plugin.create("NurbsMergeCurveKnotVectors", document)
curve2.thetamax = math.radians(180)
curve2.u_segments = 6
k3d.property.create(merge_mesh, "k3d::mesh*", "input_mesh1", "Input Mesh 1", "")
k3d.property.create(merge_mesh, "k3d::mesh*", "input_mesh2", "Input Mesh 2", "")
transform_selection = k3d.geometry.selection.create(0)
k3d.geometry.point_selection.create(transform_selection, 1)
transform.mesh_selection = transform_selection
transform.z = 3
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)
modifier.mesh_selection = selection
k3d.property.connect(document, curve2.get_property("output_mesh"), transform.get_property("input_mesh"))
k3d.property.connect(document, curve1.get_property("output_mesh"), merge_mesh.get_property("input_mesh1"))
k3d.property.connect(document, transform.get_property("output_mesh"), merge_mesh.get_property("input_mesh2"))
k3d.property.connect(document, merge_mesh.get_property("output_mesh"), modifier.get_property("input_mesh"))
testing.require_valid_mesh(document, modifier.get_property("output_mesh"))
testing.require_similar_mesh(document, modifier.get_property("output_mesh"), "mesh.modifier.NurbsMergeCurveKnotVectors", 2, ["Darwin-i386"])