ddg.visualization.blender.curve module
- ddg.visualization.blender.curve.create_curve(coordinates, name='Curve', type='POLY', with_weights=False, cyclic=None, curve=None)[source]
Create a curve object from given coordinates.
- Parameters:
- coordinatesnumpy.ndarray of shape (n,i) or list of such numpy.ndarray
Array containing the coordinates of the splines.
A single 2D array means a single spline, a list of 2D arrays means a collection of splines.
iis 4 iftypeis ‘POLY’ andwith_weightsis True. Otherwiseiis 3.nis the number of (control) points of each curve. Can be different for each curve.
- namestr (default=’Curve’)
Name of the new curve object.
- type{‘POLY’, ‘BEZIER’, ‘NURBS’}, (default=’POLY’)
Type of the created splines.
- with_weightsbool (default=False)
Specify whether weights are given.
This is only checked if
typeis ‘POLY’.If False, the weights will default to 1.0.
- cycliclist of bool (default=None)
Specify which splines are cyclic (defaulting to non-cyclic).
- curvebpy.types.Curve (default=None)
When given, the curve object to store the created data
- Returns:
- bpy.types.Curve
- ddg.visualization.blender.curve.add_curve(curvedata, name='Curve', location=(0.0, 0.0, 0.0), collection=None)[source]
Add a
bpy.types.Curveobject to a collection.- Parameters:
- curvedatabpy.types.Curve
Curve to add.
- namestr, optional
Name of the
bpy.types.Objectobject.- locationtriple of float, optional
Location of the new
bpy.types.Objectobject.- collectionbpy.types.Collection, optional
Collection to add the curve to.
- Returns:
- bpy.types.Object
The new created object containing the curve.
Notes
The
collectionoption defaults tobpy.context.scene.collection.
- ddg.visualization.blender.curve.new_bezier_curve(ctr_pts, handles, closed=False, name='Curve', collection=None)[source]
Create a new bezier curve.
- Parameters:
- ctr_ptsiterable of triples of float
Control points of the bezier curve.
- handlesiterable of tuples of triples of float
Left and right handles at the control points.
- closedbool, optional
Specify whether curve is closed.
- namestr, optional
Name of the
bpy.types.Curveandbpy.types.Objectobject, respecively.- collectionbpy.types.Collection, optional
Collection the curve shall be linked to.
- Returns:
- bpy.types.Curve or (bpy.types.Object, bpy.types.Curve)
The created curve object if
collectionis None. Else the curve object and the object linked tocollectioncontaining it.
See also
- ddg.visualization.blender.curve.set_curve_properties(curve, **properties)[source]
Set curve properties for a Blender curve.
- Parameters:
- curvebpy.types.Object or bpy.types.Curve
Curve to set properties.
- **propertieskeyword arguments
Properties to set.
- Returns:
- None
- ddg.visualization.blender.curve.create_circle_data(name='Circle', radius=1.0, location=(0.0, 0.0, 0.0), rotation=(0.0, 0.0, 0.0))[source]
Create a new bezier circle using standard
bpy.opsmethods.Creates a new
bpy.types.Curveof bezier type, wraps it in abpy.types.Objectand links this object tobpy.context.scene.collection.- Parameters:
- namestr, optional
Name of the created objects.
- radiusfloat, optional
Radius of the circle.
- locationtriple of float
Center of the
bpy.types.Objectobject.- rotationtriple of float
Rotation of the
bpy.types.Objectobject.
- Returns:
- bpy.types.Curve
- ddg.visualization.blender.curve.new_bezier_circle(trafo=array([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]]), collection=None)[source]
Create a new bezier circle.
- Parameters:
- trafonumpy ndarray, optional
Similarity transformation applied to the circle before adding.
- collectionbpy.types.Collection, optional
Collection the curve shall be linked to.
- Returns:
- bpy.types.Curve or (bpy.types.Object, bpy.types.Curve)
The created curve object if
collectionis None. Else the curve object and the object linked tocollectioncontaining it.
See also
Notes
The circle lies in the xy-plane before applying
trafo.The first control point will be
(1,0,0)before applyingtrafo.The circle is oriented in counterclockwise direction per default.
- ddg.visualization.blender.curve.new_bezier_arc(phi, nbr_ctr_pts='AUTO', trafo=array([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]]), reverse=False, collection=None)[source]
Create a circular arc bezier curve.
- Parameters:
- phifloat
Angle of the circular arc.
- nbr_ctr_ptsint, optinal
Number of control points evenly spaced on the circular arc.
- trafonumpy ndarray, optional
Similarity transformation applied to the circle before adding.
- reversebool, optional
Reverse the orientation of added circle.
- collectionbpy.types.Collection, optional
Collection the curve shall be linked to.
- Returns:
- bpy.types.Curve or (bpy.types.Object, bpy.types.Curve)
The created curve object if
collectionis None. Else the curve object and the object linked tocollectioncontaining it.
See also
Notes
The circle lies in the xy-plane before applying
trafo.The first control point will be
(1,0,0)before applyingtrafo.The circle is oriented in counterclockwise direction per default.
- ddg.visualization.blender.curve.add_bezier_points(spline, ctr_pts, handles, new=False)[source]
Add control points to a bezier spline.
- Parameters:
- splinebpy.types.Spline
Spline to operate on.
- ctr_ptsiterable of triple of float
Control points to add.
- handlesiterable of tuple of triple of float
Left and right handles at the control points.
- newbool, optional
Is the spline newly created and contains no old data.
- Returns:
- None
See also
Notes
This function CHANGES the given spline
spline.The control points and handles are paired by index.
The first item of a handle is the left handle and the second is the right.
- ddg.visualization.blender.curve.glue_bezier_points(spline, ctr_pts, handles)[source]
Add control points to a spline and match the handles.
- Parameters:
- splinebpy.types.Spline
Spline to operate on.
- ctr_ptsiterable of triple of float
Control points to add.
- handlesiterable of tuple of triple of float
Left and right handles at the control points.
- Returns:
- None
See also
Notes
This function CHANGES the given spline
spline.The spline
splinehas to contain at least one control point.The function overrides the right handle of the last control point of
spline.handleshas to contain one more item thenctr_pts.
- ddg.visualization.blender.curve.add_circle_points(spline, nbr_ctr_pts=4, trafo=array([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]]), reverse=False)[source]
Add a circle to a spline.
- Parameters:
- splinebpy.types.Spline
Spline to operate on.
- nbr_ctr_ptsint, optinal
Number of control points evenly spaced on the circle.
- trafonumpy ndarray, optional
Similarity 4x4 transformation applied to the circle before adding.
- reversebool, optional
Reverse the orientation of added circle.
- Returns:
- None
See also
Notes
This function CHANGES the given spline
spline.The circle lies in the xy-plane before applying
trafo.The first control point will be
(1,0,0)before applyingtrafo.The circle is oriented in counterclockwise direction per default.
- ddg.visualization.blender.curve.add_arc_points(spline, phi, nbr_ctr_pts='AUTO', trafo=array([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]]), reverse=False)[source]
Add a circular arc to a spline.
- Parameters:
- splinebpy.types.Spline
Spline to operate on.
- phifloat
Angle of the circular arc.
- nbr_ctr_ptsint, optinal
Number of control points evenly spaced on the circular arc.
- trafonumpy ndarray, optional
Similarity transformation applied to the circle before adding.
- reversebool, optional
Reverse the orientation of added circle.
- Returns:
- None
See also
Notes
This function CHANGES the given spline
spline.The circle lies in the xy-plane before applying
trafo.The first control point will be
(1,0,0)before applyingtrafo.The circle is oriented in counterclockwise direction per default.
- ddg.visualization.blender.curve.glue_circle_points(spline, nbr_ctr_pts=4, trafo=array([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]]), reverse=False)[source]
Add a circle to a spline and match the handles.
- Parameters:
- splinebpy.types.Spline
Spline to operate on.
- nbr_ctr_ptsint, optinal
Number of control points evenly spaced on the circel.
- trafonumpy ndarray, optional
Similarity transformation applied to the circle before adding.
- reversebool, optional
Reverse the orientation of added circle.
- Returns:
- None
See also
Notes
This function CHANGES the given spline
spline.The circle lies in the xy-plane before applying
trafo.The first control point will be
(1,0,0)before applyingtrafo.The circle is oriented in counterclockwise direction per default.
- ddg.visualization.blender.curve.glue_arc_points(spline, phi, nbr_ctr_pts='AUTO', trafo=array([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]]), reverse=False)[source]
Add a circular arc to a spline and match the handles.
- Parameters:
- splinebpy.types.Spline
Spline to operate on.
- phifloat
Angle of the circular arc.
- nbr_ctr_ptsint, optinal
Number of control points evenly spaced on the circular arc.
- trafonumpy ndarray, optional
Similarity transformation applied to the circle before adding.
- reversebool, optional
Reverse the orientation of added circle.
- Returns:
- None
See also
Notes
This function CHANGES the given spline
spline.The circle lies in the xy-plane before applying
trafo.The first control point will be
(1,0,0)before applyingtrafo.The circle is oriented in counterclockwise direction per default.