How to use the k3d.geometry.point_selection.create function in k3d

To help you get started, we’ve selected a few k3d examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github K-3D / k3d / tests / mesh.modifier.TranslatePoints.py View on Github external
#python

import k3d
import testing

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

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

setup.modifier.mesh_selection = selection
setup.modifier.x = 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.TranslatePoints", 1)
github K-3D / k3d / tests / mesh / mesh.modifier.BulgePoints.py View on Github external
#python

import k3d
import testing

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

setup.source.radius = 1

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

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


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.BulgePoints", 2, ["Darwin-i386"])
github K-3D / k3d / tests / mesh / mesh.selection.points.py View on Github external
#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)
point_selection = k3d.geometry.point_selection.create(mesh_selection)
point_selection.index_begin().append(0)
point_selection.index_end().append(2)
point_selection.weight().append(1)

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.points", 1)
github K-3D / k3d / tests / mesh / mesh.modifier.CollapsePoints.py View on Github external
#python

import k3d
import testing

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

selection = k3d.selection.set()
point_selection = k3d.geometry.point_selection.create(selection)
k3d.geometry.point_selection.append(point_selection, 14, 16, 1)
k3d.geometry.point_selection.append(point_selection, 20, 22, 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.CollapsePoints", 2)
github K-3D / k3d / tests / mesh / mesh.modifier.SmoothPoints.py View on Github external
#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.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.SmoothPoints", 1)
github K-3D / k3d / tests / mesh / mesh.modifier.TransformPoints.py View on Github external
#python

import k3d
import testing

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

selection = k3d.geometry.selection.create(0)
selection.points = k3d.geometry.point_selection.create(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)
github K-3D / k3d / tests / mesh / modifier.DeleteComponents.complex.py View on Github external
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("K3DMeshReader", "DeleteComponents")
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)

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
github K-3D / k3d / tests / mesh / mesh.modifier.TaperPoints.py View on Github external
#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"])
github K-3D / k3d / tests / mesh / mesh.modifier.LinearWavePoints.py View on Github external
#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"])
github K-3D / k3d / tests / mesh / mesh.modifier.NurbsRuledSurface.py View on Github external
import k3d
from math import pi

document = k3d.new_document()

curve1 = k3d.plugin.create("NurbsCurve", document)
curve2 = k3d.plugin.create("NurbsCircle", document)
transform = k3d.plugin.create("RotatePoints", document)
merge_mesh = k3d.plugin.create("MergeMesh", document)
modifier = k3d.plugin.create("NurbsRuledSurface", document)

merge_mesh.create_property("k3d::mesh*", "input_mesh1", "Input Mesh 1", "")
merge_mesh.create_property("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.y = 0.5*pi

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

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.NurbsRuledSurface", 1)