Linear Extrusion ile king orking
Performing Linear truxtrusion
Aspose.3D for Python via .NET, bir giriş olarak 2d şekli alan ve üçüncü boyuttaki şekli genişleten LinearExtrusion sınıfı sunar. Aşağıdaki kod parçacığı, lineer extrusion yonun nasıl gerçekleştirileceğini gösterir:
from aspose.threed import FileFormat, Scene
from aspose.threed.entities import LinearExtrusion
from aspose.threed.profiles import RectangleShape
from aspose.threed.utilities import Vector3
shape = RectangleShape()
shape.rounding_radius = 0.3
# For complete examples and data files, please go to https:# github.com/aspose-3d/Aspose.3D-for-.NET
# Initialize the base profile to be extruded
profile = shape
extrusion = LinearExtrusion(profile, 10)
extrusion.slices = 100
extrusion.center = True
extrusion.twist = 360.0
extrusion.twist_offset = Vector3(10, 0, 0)
# Perform Linear extrusion by passing a 2D profile as input and extend the shape in the 3rd dimension
extrusion = extrusion
# Create a scene
scene = Scene()
# Create a child node by passing extrusion
scene.root_node.create_child_node(extrusion)
# Save 3D scene
scene.save("out" + "LinearExtrusion.obj", FileFormat.WAVEFRONT_OBJ)‘Slices’ in Linear truxtrusion
Aspose.3D for Python via .NET offers slices property of LinearExtrusion class. slices property defines the number of intermediate points along the path of the extrusion. Following code snippet shows how to use slices property in linear extrusion:
from aspose.threed import FileFormat, Scene
from aspose.threed.entities import LinearExtrusion
from aspose.threed.profiles import RectangleShape
from aspose.threed.utilities import Vector3
shape = RectangleShape()
shape.rounding_radius = 0.3
# For complete examples and data files, please go to https:# github.com/aspose-3d/Aspose.3D-for-.NET
# Initialize the base profile to be extruded
profile = shape
# Create a scene
scene = Scene()
# Create left node
left = scene.root_node.create_child_node()
# Create right node
right = scene.root_node.create_child_node()
left.transform.translation = Vector3(15, 0, 0)
extrusion = LinearExtrusion(profile, 2)
extrusion.slices = 2
# Slices parameter defines the number of intermediate points along the path of the extrusion
# Perform linear extrusion on left node using slices property
left.create_child_node(extrusion)
extrusion2 = LinearExtrusion(profile, 2)
extrusion2.slices = 10
# Perform linear extrusion on right node using slices property
right.create_child_node(extrusion2)
# Save 3D scene
scene.save("out" + "SlicesInLinearExtrusion.obj", FileFormat.WAVEFRONT_OBJ)Linear truxtrusion ‘center’
Aspose.3D for Python via .NET offers center property of LinearExtrusion class. If the center property is set to True, the extrusion range is from -Height/2 to Height/2, otherwise, the extrusion is from 0 to Height. Following code snippet shows how to use center property in linear extrusion:
from aspose.threed import FileFormat, Scene
from aspose.threed.entities import LinearExtrusion
from aspose.threed.profiles import RectangleShape
from aspose.threed.utilities import Vector3
shape = RectangleShape()
shape.rounding_radius = 0.3
# For complete examples and data files, please go to https:# github.com/aspose-3d/Aspose.3D-for-.NET
# Initialize the base profile to be extruded
profile = shape
# Create a scene
scene = Scene()
# Create left node
left = scene.root_node.create_child_node()
# Create right node
right = scene.root_node.create_child_node()
left.transform.translation = Vector3(15, 0, 0)
extrusion = LinearExtrusion(profile, 2)
extrusion.slices = 2
# Slices parameter defines the number of intermediate points along the path of the extrusion
# Perform linear extrusion on left node using slices property
left.create_child_node(extrusion)
extrusion2 = LinearExtrusion(profile, 2)
extrusion2.slices = 10
# Perform linear extrusion on right node using slices property
right.create_child_node(extrusion2)
# Save 3D scene
scene.save("out" + "SlicesInLinearExtrusion.obj", FileFormat.WAVEFRONT_OBJ)Linear Extrusion ‘twist’
Aspose.3D for Python via .NET offers twist property of LinearExtrusion class. twist property handles the degree of the rotation while extruding the shape. Following code snippet shows how to use twist property in linear extrusion:
from aspose.threed import FileFormat, Scene
from aspose.threed.entities import LinearExtrusion
from aspose.threed.profiles import RectangleShape
from aspose.threed.utilities import Vector3
shape = RectangleShape()
shape.rounding_radius = 0.3
# For complete examples and data files, please go to https:# github.com/aspose-3d/Aspose.3D-for-.NET
# Initialize the base profile to be extruded
profile = shape
# Create a scene
scene = Scene()
# Create left node
left = scene.root_node.create_child_node()
# Create rifht node
right = scene.root_node.create_child_node()
left.transform.translation = Vector3(15, 0, 0)
extrusion = LinearExtrusion(profile, 10)
extrusion.twist = 0.0
extrusion.slices = 100
# Twist property defines the degree of the rotation while extruding the profile
# Perform linear extrusion on left node using twist and slices property
left.create_child_node(extrusion)
extrusion2 = LinearExtrusion(profile, 10)
extrusion2.twist = 90.0
extrusion2.slices = 100
# Perform linear extrusion on right node using twist and slices property
right.create_child_node(extrusion2)
# Save 3D scene
scene.save("out" + "TwistInLinearExtrusion.obj", FileFormat.WAVEFRONT_OBJ)Linear truxtrusion ‘twist _ offset’
Aspose.3D for Python via .NET offers twist_offset property of LinearExtrusion class. twist_offset property translates offset while rotating the extrusion. Following code snippet shows how to use twist_offset property in linear extrusion:
from aspose.threed import FileFormat, Scene
from aspose.threed.entities import LinearExtrusion
from aspose.threed.profiles import RectangleShape
from aspose.threed.utilities import Vector3
shape = RectangleShape()
shape.rounding_radius = 0.3
# For complete examples and data files, please go to https:# github.com/aspose-3d/Aspose.3D-for-.NET
# Initialize the base profile to be extruded
profile = shape
# Create a scene
scene = Scene()
# Create left node
left = scene.root_node.create_child_node()
# Create right node
right = scene.root_node.create_child_node()
left.transform.translation = Vector3(18, 0, 0)
extrusion = LinearExtrusion(profile, 10)
extrusion.twist = 360.0
extrusion.slices = 100
# TwistOffset property is the translate offset while rotating the extrusion.
# Perform linear extrusion on left node using twist and slices property
left.create_child_node(extrusion)
extrusion2 = LinearExtrusion(profile, 10)
extrusion2.twist = 360.0
extrusion2.slices = 100
extrusion2.twist_offset = Vector3(3, 0, 0)
# Perform linear extrusion on right node using twist, twist offset and slices property
right.create_child_node(extrusion2)
# Save 3D scene
scene.save("out" + "TwistOffsetInLinearExtrusion.obj", FileFormat.WAVEFRONT_OBJ)Linear direcxtrusion ‘direction’
Aspose.3D for Python via .NET offers direction property of LinearExtrusion class. direction property defines the direction of the extrusion. Following code snippet shows how to use direction property in linear extrusion:
from aspose.threed import FileFormat, Scene
from aspose.threed.entities import LinearExtrusion
from aspose.threed.profiles import RectangleShape
from aspose.threed.utilities import Vector3
shape = RectangleShape()
shape.rounding_radius = 0.3
# For complete examples and data files, please go to https:# github.com/aspose-3d/Aspose.3D-for-.NET
# Initialize the base profile to be extruded
profile = shape
# Create a scene
scene = Scene()
# Create left node
left = scene.root_node.create_child_node()
# Create right node
right = scene.root_node.create_child_node()
left.transform.translation = Vector3(8, 0, 0)
extrusion = LinearExtrusion(profile, 10)
extrusion.twist = 360.0
extrusion.slices = 100
# Direction property defines the direction of the extrusion.
# Perform linear extrusion on left node using twist and slices property
left.create_child_node(extrusion)
extrusion2 = LinearExtrusion(profile, 10)
extrusion2.twist = 360.0
extrusion2.slices = 100
extrusion2.direction = Vector3(0.3, 0.2, 1)
# Perform linear extrusion on right node using twist, slices, and direction property
right.create_child_node(extrusion2)
# Save 3D scene
scene.save("out" + "DirectionInLinearExtrusion.obj", FileFormat.WAVEFRONT_OBJ)