How to use the k3d.geometry 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 / mesh.modifier.RotatePoints.py View on Github external
#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)
github K-3D / k3d / tests / mesh / mesh.modifier.EulerKillEdgeMakeLoop.py View on Github external
#python

import k3d
import testing

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

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

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, 7, 8, 1)
k3d.geometry.primitive_selection.append(edge_selection, 1, 2, 1)
k3d.geometry.primitive_selection.append(edge_selection, 2, 3, 1)
k3d.geometry.primitive_selection.append(edge_selection, 12, 13, 1)
k3d.geometry.primitive_selection.append(edge_selection, 14, 15, 1)
k3d.geometry.primitive_selection.append(edge_selection, 24, 25, 1)
k3d.geometry.primitive_selection.append(edge_selection, 31, 32, 1)
k3d.geometry.primitive_selection.append(edge_selection, 25, 26, 1)
k3d.geometry.primitive_selection.append(edge_selection, 35, 36, 1)
k3d.geometry.primitive_selection.append(edge_selection, 29, 30, 1)
k3d.geometry.primitive_selection.append(edge_selection, 22, 23, 1)
k3d.geometry.primitive_selection.append(edge_selection, 32, 33, 1)
k3d.geometry.primitive_selection.append(edge_selection, 10, 11, 1)
k3d.geometry.primitive_selection.append(edge_selection, 20, 21, 1)
k3d.geometry.primitive_selection.append(edge_selection, 5, 6, 1)
k3d.geometry.primitive_selection.append(edge_selection, 11, 12, 1)
setup.modifier.mesh_selection = selection
github K-3D / k3d / tests / parallel / grain_size.ScalePoints.py View on Github external
#python

import k3d
import sys
import testing

# Create a mesh source and our test modifier ...
setup = testing.setup_mesh_modifier_test("PolyGrid", "ScalePoints")
setup.source.rows = 100
setup.source.columns = 100

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

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

thread_count = 2

grain_sizes = []
timings = []

for grain_size in range(5000, 100000, 5000):
	k3d.parallel.set_grain_size(grain_size)
	k3d.parallel.set_thread_count(thread_count)
	setup.modifier.x = 1.0
	setup.modifier.x = 2.0
github K-3D / k3d / tests / mesh / mesh.modifier.BevelPoints.py View on Github external
#python

import k3d
import testing

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

selection = k3d.selection.set()
point_selection = k3d.geometry.point_selection.create(selection)
k3d.geometry.point_selection.append(point_selection, 0, 4, 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.BevelPoints", 1)
github K-3D / k3d / tests / mesh.modifier.BevelFaces.py View on Github external
#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)
github K-3D / k3d / tests / mesh / mesh.modifier.NurbsMergeConnectedCurves.py View on Github external
#python

import k3d
import testing

document = k3d.new_document()

selection = k3d.geometry.selection.create(1)
circle = k3d.plugin.create("NurbsCircle", document)
split1 = k3d.plugin.create("NurbsSplitCurve", document)
split2 = k3d.plugin.create("NurbsSplitCurve", document)
merge = k3d.plugin.create("NurbsMergeConnectedCurves", document)

split1.mesh_selection = selection
split2.mesh_selection = selection
merge.mesh_selection = selection

k3d.property.connect(document, circle.get_property("output_mesh"), split1.get_property("input_mesh"))
k3d.property.connect(document, split1.get_property("output_mesh"), split2.get_property("input_mesh"))
k3d.property.connect(document, split2.get_property("output_mesh"), merge.get_property("input_mesh"))

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