cam.operators.curve_create_ops

Contents

cam.operators.curve_create_ops#

Fabex ‘curve_cam_create.py’ © 2021, 2022 Alain Pelletier

Operators to create a number of predefined curve objects.

Classes#

CamCurveHatch

Perform Hatch Operation on Single or Multiple Curves

CamCurvePlate

Perform Generates Rounded Plate with Mounting Holes

CamCurveFlatCone

Generates cone from flat stock

CamCurveMortise

Generates Mortise Along a Curve

CamCurveInterlock

Generates Interlock Along a Curve

CamCurveDrawer

Generates Drawers

CamCurvePuzzle

Generates Puzzle Joints and Interlocks

CamCurveGear

Generates Involute Gears // version 1.1 by Leemon Baird, 2011, Leemon@Leemon.com

Functions#

generate_crosshatch(context, angle, distance, offset, ...)

Execute the crosshatch generation process based on the provided context.

Module Contents#

generate_crosshatch(context, angle, distance, offset, pocket_shape, join, ob=None)[source]#

Execute the crosshatch generation process based on the provided context.

Parameters:
  • context (bpy.context) – The Blender context containing the active object.

  • angle (float) – The angle for rotating the crosshatch pattern.

  • distance (float) – The distance between crosshatch lines.

  • offset (float) – The offset for the bounds or hull.

  • pocket_shape (str) – Determines whether to use bounds, hull, or pocket.

Returns:

The resulting intersection geometry of the crosshatch.

Return type:

shapely.geometry.MultiLineString

class CamCurveHatch[source]#

Bases: bpy.types.Operator

Perform Hatch Operation on Single or Multiple Curves

bl_idname = 'object.curve_hatch'[source]#
bl_label = 'CrossHatch Curve'[source]#
bl_options[source]#
angle: FloatProperty(default=0, min=-pi / 2, max=pi / 2, precision=4, subtype='ANGLE')[source]#
distance: FloatProperty(default=0.003, min=0, max=3.0, precision=4, unit='LENGTH')[source]#
offset: FloatProperty(default=0, min=-1.0, max=3.0, precision=4, unit='LENGTH')[source]#
pocket_shape: EnumProperty(name='Pocket Shape', items='BOUNDS', 'Bounds Rectangle', 'Uses a bounding rectangle', 'HULL', 'Convex Hull', 'Uses a convex hull', 'POCKET', 'Pocket', 'Uses the pocket shape', description='Type of pocket shape', default='POCKET')[source]#
contour: BoolProperty(name='Contour Curve', default=False)[source]#
xhatch: BoolProperty(name='Crosshatch #', default=False)[source]#
contour_separate: BoolProperty(name='Contour Separate', default=False)[source]#
straight: BoolProperty(name='Overshoot Style', description='Use overshoot cutout instead of conventional rounded', default=True)[source]#
classmethod poll(context)[source]#
draw(context)[source]#

Draw the layout properties for the given context.

execute(context)[source]#
class CamCurvePlate[source]#

Bases: bpy.types.Operator

Perform Generates Rounded Plate with Mounting Holes

bl_idname = 'object.curve_plate'[source]#
bl_label = 'Sign Plate'[source]#
bl_options[source]#
radius: FloatProperty(name='Corner Radius', default=0.025, min=0, max=0.1, precision=4, unit='LENGTH')[source]#
width: FloatProperty(name='Width of Plate', default=0.3048, min=0, max=3.0, precision=4, unit='LENGTH')[source]#
height: FloatProperty(name='Height of Plate', default=0.457, min=0, max=3.0, precision=4, unit='LENGTH')[source]#
hole_diameter: FloatProperty(name='Hole Diameter', default=0.01, min=0, max=3.0, precision=4, unit='LENGTH')[source]#
hole_tolerance: FloatProperty(name='Hole V Tolerance', default=0.005, min=0, max=3.0, precision=4, unit='LENGTH')[source]#
hole_vdist: FloatProperty(name='Hole Vert Distance', default=0.4, min=0, max=3.0, precision=4, unit='LENGTH')[source]#
hole_hdist: FloatProperty(name='Hole Horiz Distance', default=0, min=0, max=3.0, precision=4, unit='LENGTH')[source]#
hole_hamount: IntProperty(name='Hole Horiz Amount', default=1, min=0, max=50)[source]#
resolution: IntProperty(name='Spline Resolution', default=50, min=3, max=150)[source]#
plate_type: EnumProperty(name='Type Plate', items='ROUNDED', 'Rounded corner', 'Makes a rounded corner plate', 'COVE', 'Cove corner', 'Makes a plate with circles cut in each corner ', 'BEVEL', 'Bevel corner', 'Makes a plate with beveled corners ', 'OVAL', 'Elipse', 'Makes an oval plate', description='Type of Plate', default='ROUNDED')[source]#
draw(context)[source]#

Draw the UI layout for plate properties.

This method creates a user interface layout for configuring various properties of a plate, including its type, dimensions, hole specifications, and resolution. It dynamically adds properties to the layout based on the selected plate type, allowing users to input relevant parameters.

Parameters:

context – The context in which the UI is being drawn.

execute(context)[source]#

Execute the creation of a plate based on specified parameters.

This function generates a plate shape in Blender based on the defined attributes such as width, height, radius, and plate type. It supports different plate types including rounded, oval, cove, and bevel. The function also handles the creation of holes in the plate if specified. It utilizes Blender’s curve operations to create the geometry and applies various transformations to achieve the desired shape.

Parameters:

context (bpy.context) – The Blender context in which the operation is performed.

Returns:

A dictionary indicating the result of the operation, typically

{‘FINISHED’} if successful.

Return type:

dict

class CamCurveFlatCone[source]#

Bases: bpy.types.Operator

Generates cone from flat stock

bl_idname = 'object.curve_flat_cone'[source]#
bl_label = 'Cone Flat Calculator'[source]#
bl_options[source]#
small_d: FloatProperty(name='Small Diameter', default=0.025, min=0, max=0.1, precision=4, unit='LENGTH')[source]#
large_d: FloatProperty(name='Large Diameter', default=0.3048, min=0, max=3.0, precision=4, unit='LENGTH')[source]#
height: FloatProperty(name='Height of Cone', default=0.457, min=0, max=3.0, precision=4, unit='LENGTH')[source]#
tab: FloatProperty(name='Tab Witdh', default=0.01, min=0, max=0.1, precision=4, unit='LENGTH')[source]#
intake: FloatProperty(name='Intake Diameter', default=0, min=0, max=0.2, precision=4, unit='LENGTH')[source]#
intake_skew: FloatProperty(name='Intake Skew', default=1, min=0.1, max=4)[source]#
resolution: IntProperty(name='Resolution', default=12, min=5, max=200)[source]#
execute(context)[source]#

Execute the construction of a geometric shape in Blender.

This method performs a series of operations to create a geometric shape based on specified dimensions and parameters. It calculates various dimensions needed for the shape, including height and angles, and then uses Blender’s operations to create segments, rectangles, and ellipses. The function also handles the positioning and rotation of these shapes within the 3D space of Blender.

Parameters:

context – The context in which the operation is executed, typically containing information about the current scene and active objects in Blender.

Returns:

A dictionary indicating the completion status of the operation,

typically {‘FINISHED’}.

Return type:

dict

class CamCurveMortise[source]#

Bases: bpy.types.Operator

Generates Mortise Along a Curve

bl_idname = 'object.curve_mortise'[source]#
bl_label = 'Mortise'[source]#
bl_options[source]#
finger_size: BoolProperty(name='Kurf Bending only', default=False)[source]#
min_finger_size: FloatProperty(name='Minimum Finger Size', default=0.0025, min=0.001, max=3.0, precision=4, unit='LENGTH')[source]#
finger_tolerance: FloatProperty(name='Finger Play Room', default=4.5e-05, min=0, max=0.003, precision=4, unit='LENGTH')[source]#
plate_thickness: FloatProperty(name='Drawer Plate Thickness', default=0.00477, min=0.001, max=3.0, unit='LENGTH')[source]#
side_height: FloatProperty(name='Side Height', default=0.05, min=0.001, max=3.0, unit='LENGTH')[source]#
flex_pocket: FloatProperty(name='Flex Pocket', default=0.004, min=0.0, max=1.0, unit='LENGTH')[source]#
top_bottom: BoolProperty(name='Side Top & Bottom Fingers', default=True)[source]#
opencurve: BoolProperty(name='OpenCurve', default=False)[source]#
adaptive: FloatProperty(name='Adaptive Angle Threshold', default=0.0, min=0.0, max=2, step=100, subtype='ANGLE', unit='ROTATION')[source]#
double_adaptive: BoolProperty(name='Double Adaptive Pockets', default=False)[source]#
classmethod poll(context)[source]#
execute(context)[source]#

Execute the joinery process based on the provided context.

This function performs a series of operations to duplicate the active object, convert it to a mesh, and then process its geometry to create joinery features. It extracts vertex coordinates, converts them into a LineString data structure, and applies either variable or fixed finger joinery based on the specified parameters. The function also handles the creation of flexible sides and pockets if required.

Parameters:

context (bpy.context) – The context in which the operation is executed.

Returns:

A dictionary indicating the completion status of the operation.

Return type:

dict

class CamCurveInterlock[source]#

Bases: bpy.types.Operator

Generates Interlock Along a Curve

bl_idname = 'object.curve_interlock'[source]#
bl_label = 'Interlock'[source]#
bl_options[source]#
finger_size: FloatProperty(name='Finger Size', default=0.015, min=0.005, max=3.0, precision=4, unit='LENGTH')[source]#
finger_tolerance: FloatProperty(name='Finger Play Room', default=4.5e-05, min=0, max=0.003, precision=4, unit='LENGTH')[source]#
plate_thickness: FloatProperty(name='Plate Thickness', default=0.00477, min=0.001, max=3.0, unit='LENGTH')[source]#
opencurve: BoolProperty(name='OpenCurve', default=False)[source]#
interlock_type: EnumProperty(name='Type of Interlock', items='TWIST', 'Twist', 'Interlock requires 1/4 turn twist', 'GROOVE', 'Groove', 'Simple sliding groove', 'PUZZLE', 'Puzzle Interlock', 'Puzzle good for flat joints', description='Type of interlock', default='GROOVE')[source]#
finger_amount: IntProperty(name='Finger Amount', default=2, min=1, max=100)[source]#
tangent_angle: FloatProperty(name='Tangent Deviation', default=0.0, min=0.0, max=2, step=100, subtype='ANGLE', unit='ROTATION')[source]#
fixed_angle: FloatProperty(name='Fixed Angle', default=0.0, min=0.0, max=2, step=100, subtype='ANGLE', unit='ROTATION')[source]#
execute(context)[source]#

Execute the joinery operation based on the selected objects in the context.

This function checks the selected objects in the provided context and performs different operations depending on the type of the active object. If the active object is a curve or font and there are selected objects, it duplicates the object, converts it to a mesh, and processes its vertices to create a LineString representation. The function then calculates lengths and applies distributed interlock joinery based on the specified parameters. If no valid objects are selected, it defaults to a single interlock operation at the cursor’s location.

Parameters:

context (bpy.context) – The context containing selected objects and active object.

Returns:

A dictionary indicating the operation’s completion status.

Return type:

dict

class CamCurveDrawer[source]#

Bases: bpy.types.Operator

Generates Drawers

bl_idname = 'object.curve_drawer'[source]#
bl_label = 'Drawer'[source]#
bl_options[source]#
depth: FloatProperty(name='Drawer Depth', default=0.2, min=0, max=1.0, precision=4, unit='LENGTH')[source]#
width: FloatProperty(name='Drawer Width', default=0.125, min=0, max=3.0, precision=4, unit='LENGTH')[source]#
height: FloatProperty(name='Drawer Height', default=0.07, min=0, max=3.0, precision=4, unit='LENGTH')[source]#
finger_size: FloatProperty(name='Maximum Finger Size', default=0.015, min=0.005, max=3.0, precision=4, unit='LENGTH')[source]#
finger_tolerance: FloatProperty(name='Finger Play Room', default=4.5e-05, min=0, max=0.003, precision=4, unit='LENGTH')[source]#
finger_inset: FloatProperty(name='Finger Inset', default=0.0, min=0.0, max=0.01, precision=4, unit='LENGTH')[source]#
drawer_plate_thickness: FloatProperty(name='Drawer Plate Thickness', default=0.00477, min=0.001, max=3.0, precision=4, unit='LENGTH')[source]#
drawer_hole_diameter: FloatProperty(name='Drawer Hole Diameter', default=0.02, min=1e-05, max=0.5, precision=4, unit='LENGTH')[source]#
drawer_hole_offset: FloatProperty(name='Drawer Hole Offset', default=0.0, min=-0.5, max=0.5, precision=4, unit='LENGTH')[source]#
overcut: BoolProperty(name='Add Overcut', default=False)[source]#
overcut_diameter: FloatProperty(name='Overcut Tool Diameter', default=0.003175, min=-0.001, max=0.5, precision=4, unit='LENGTH')[source]#
draw(context)[source]#

Draw the user interface properties for the object.

This method is responsible for rendering the layout of various properties related to the object’s dimensions and specifications. It adds properties such as depth, width, height, finger size, finger tolerance, finger inset, drawer plate thickness, drawer hole diameter, drawer hole offset, and overcut diameter to the layout. The overcut diameter property is only added if the overcut option is enabled.

Parameters:

context – The context in which the drawing occurs, typically containing information about the current state and environment.

execute(context)[source]#

Execute the drawer creation process in Blender.

This method orchestrates the creation of a drawer by calculating the necessary dimensions for the finger joints, creating the base plate, and generating the drawer components such as the back, front, sides, and bottom. It utilizes various helper functions to perform operations like boolean differences and transformations to achieve the desired geometry. The method also handles the placement of the drawer components in the 3D space.

Parameters:

context (bpy.context) – The Blender context that provides access to the current scene and objects.

Returns:

A dictionary indicating the completion status of the operation,

typically {‘FINISHED’}.

Return type:

dict

class CamCurvePuzzle[source]#

Bases: bpy.types.Operator

Generates Puzzle Joints and Interlocks

bl_idname = 'object.curve_puzzle'[source]#
bl_label = 'Puzzle Joints'[source]#
bl_options[source]#
diameter: FloatProperty(name='Tool Diameter', default=0.003175, min=0.001, max=3.0, precision=4, unit='LENGTH')[source]#
finger_tolerance: FloatProperty(name='Finger Play Room', default=5e-05, min=0, max=0.003, precision=4, unit='LENGTH')[source]#
finger_amount: IntProperty(name='Finger Amount', default=1, min=0, max=100)[source]#
stem_size: IntProperty(name='Size of the Stem', default=2, min=1, max=200)[source]#
width: FloatProperty(name='Width', default=0.1, min=0.005, max=3.0, precision=4, unit='LENGTH')[source]#
height: FloatProperty(name='Height or Thickness', default=0.025, min=0.005, max=3.0, precision=4, unit='LENGTH')[source]#
angle: FloatProperty(name='Angle A', default=pi / 4, min=-10, max=10, step=500, subtype='ANGLE', unit='ROTATION')[source]#
angleb: FloatProperty(name='Angle B', default=pi / 4, min=-10, max=10, step=500, subtype='ANGLE', unit='ROTATION')[source]#
radius: FloatProperty(name='Arc Radius', default=0.025, min=0.005, max=5, precision=4, unit='LENGTH')[source]#
interlock_type: EnumProperty(name='Type of Shape', items='JOINT', 'Joint', 'Puzzle Joint interlock', 'BAR', 'Bar', 'Bar interlock', 'ARC', 'Arc', 'Arc interlock', 'MULTIANGLE', 'Multi angle', 'Multi angle joint', 'CURVEBAR', 'Arc Bar', 'Arc Bar interlock', 'CURVEBARCURVE', 'Arc Bar Arc', 'Arc Bar Arc interlock', 'CURVET', 'T curve', 'T curve interlock', 'T', 'T Bar', 'T Bar interlock', 'CORNER', 'Corner Bar', 'Corner Bar interlock', 'TILE', 'Tile', 'Tile interlock', 'OPENCURVE', 'Open Curve', 'Corner Bar interlock', description='Type of interlock', default='CURVET')[source]#
gender: EnumProperty(name='Type Gender', items='MF', 'Male-Receptacle', 'Male and receptacle', 'F', 'Receptacle only', 'Receptacle', 'M', 'Male only', 'Male', description='Type of interlock', default='MF')[source]#
base_gender: EnumProperty(name='Base Gender', items='MF', 'Male - Receptacle', 'Male - Receptacle', 'F', 'Receptacle', 'Receptacle', 'M', 'Male', 'Male', description='Type of interlock', default='M')[source]#
multiangle_gender: EnumProperty(name='Multiangle Gender', items='MMF', 'Male Male Receptacle', 'M M F', 'MFF', 'Male Receptacle Receptacle', 'M F F', description='Type of interlock', default='MFF')[source]#
mitre: BoolProperty(name='Add Mitres', default=False)[source]#
twist_lock: BoolProperty(name='Add TwistLock', default=False)[source]#
twist_thick: FloatProperty(name='Twist Thickness', default=0.0047, min=0.001, max=3.0, precision=4, unit='LENGTH')[source]#
twist_percent: FloatProperty(name='Twist Neck', default=0.3, min=0.1, max=0.9, precision=4)[source]#
twist_keep: BoolProperty(name='Keep Twist Holes', default=False)[source]#
twist_line: BoolProperty(name='Add Twist to Bar', default=False)[source]#
twist_line_amount: IntProperty(name='Amount of Separators', default=2, min=1, max=600)[source]#
twist_separator: BoolProperty(name='Add Twist Separator', default=False)[source]#
twist_separator_amount: IntProperty(name='Amount of Separators', default=2, min=2, max=600)[source]#
twist_separator_spacing: FloatProperty(name='Separator Spacing', default=0.025, min=-0.004, max=1.0, precision=4, unit='LENGTH')[source]#
twist_separator_edge_distance: FloatProperty(name='Separator Edge Distance', default=0.01, min=0.0005, max=0.1, precision=4, unit='LENGTH')[source]#
tile_x_amount: IntProperty(name='Amount of X Fingers', default=2, min=1, max=600)[source]#
tile_y_amount: IntProperty(name='Amount of Y Fingers', default=2, min=1, max=600)[source]#
interlock_amount: IntProperty(name='Interlock Amount on Curve', default=2, min=0, max=200)[source]#
overcut: BoolProperty(name='Add Overcut', default=False)[source]#
overcut_diameter: FloatProperty(name='Overcut Tool Diameter', default=0.003175, min=-0.001, max=0.5, precision=4, unit='LENGTH')[source]#
draw(context)[source]#

Draws the user interface layout for interlock type properties.

This method is responsible for creating and displaying the layout of various properties related to different interlock types in the user interface. It dynamically adjusts the layout based on the selected interlock type, allowing users to input relevant parameters such as dimensions, tolerances, and other characteristics specific to the chosen interlock type.

Parameters:

context – The context in which the layout is being drawn, typically provided by the user interface framework.

Returns:

This method does not return any value; it modifies the layout

directly.

Return type:

None

execute(context)[source]#

Execute the puzzle joinery process based on the provided context.

This method processes the selected objects in the given context to perform various types of puzzle joinery operations. It first checks if there are any selected objects and if the active object is a curve. If so, it duplicates the object, applies transformations, and converts it to a mesh. The method then extracts vertex coordinates and performs different joinery operations based on the specified interlock type. Supported interlock types include ‘FINGER’, ‘JOINT’, ‘BAR’, ‘ARC’, ‘CURVEBARCURVE’, ‘CURVEBAR’, ‘MULTIANGLE’, ‘T’, ‘CURVET’, ‘CORNER’, ‘TILE’, and ‘OPENCURVE’.

Parameters:

context (Context) – The context containing selected objects and the active object.

Returns:

A dictionary indicating the completion status of the operation.

Return type:

dict

class CamCurveGear[source]#

Bases: bpy.types.Operator

Generates Involute Gears // version 1.1 by Leemon Baird, 2011, Leemon@Leemon.com http://www.thingiverse.com/thing:5505

bl_idname = 'object.curve_gear'[source]#
bl_label = 'Gears'[source]#
bl_options[source]#
tooth_spacing: FloatProperty(name='Distance per Tooth', default=0.01, min=0.001, max=1.0, precision=4, unit='LENGTH')[source]#
tooth_amount: IntProperty(name='Amount of Teeth', default=7, min=4)[source]#
spoke_amount: IntProperty(name='Amount of Spokes', default=4, min=0)[source]#
hole_diameter: FloatProperty(name='Hole Diameter', default=0.003175, min=0, max=3.0, precision=4, unit='LENGTH')[source]#
rim_size: FloatProperty(name='Rim Size', default=0.003175, min=0, max=3.0, precision=4, unit='LENGTH')[source]#
hub_diameter: FloatProperty(name='Hub Diameter', default=0.005, min=0, max=3.0, precision=4, unit='LENGTH')[source]#
pressure_angle: FloatProperty(name='Pressure Angle', default=radians(20), min=0.001, max=pi / 2, precision=4, step=100, subtype='ANGLE', unit='ROTATION')[source]#
clearance: FloatProperty(name='Clearance', default=0.0, min=0, max=0.1, precision=4, unit='LENGTH')[source]#
backlash: FloatProperty(name='Backlash', default=0.0, min=0.0, max=0.1, precision=4, unit='LENGTH')[source]#
rack_height: FloatProperty(name='Rack Height', default=0.012, min=0.001, max=1, precision=4, unit='LENGTH')[source]#
rack_tooth_per_hole: IntProperty(name='Teeth per Mounting Hole', default=7, min=2)[source]#
gear_type: EnumProperty(name='Type of Gear', items='PINION', 'Pinion', 'Circular Gear', 'RACK', 'Rack', 'Straight Rack', description='Type of gear', default='PINION')[source]#
draw(context)[source]#

Draw the user interface properties for gear settings.

This method sets up the layout for various gear parameters based on the selected gear type. It dynamically adds properties to the layout for different gear types, allowing users to input specific values for gear design. The properties include gear type, tooth spacing, tooth amount, hole diameter, pressure angle, and backlash. Additional properties are displayed if the gear type is ‘PINION’ or ‘RACK’.

Parameters:

context – The context in which the layout is being drawn.

execute(context)[source]#

Execute the gear generation process based on the specified gear type.

This method checks the type of gear to be generated (either ‘PINION’ or ‘RACK’) and calls the appropriate function from the involute_gear module to create the gear or rack with the specified parameters. The parameters include tooth spacing, number of teeth, hole diameter, pressure angle, clearance, backlash, rim size, hub diameter, and spoke amount for pinion gears, and additional parameters for rack gears.

Parameters:

context – The context in which the execution is taking place.

Returns:

A dictionary indicating that the operation has finished with a key

’FINISHED’.

Return type:

dict