Skip to content

BASIC / HINGE

Hinge

Reusable two-leaf hinge with a native bounded revolute joint

Built in SolidCraft 0.49.0 14 commands

Model preview

Hinge SolidCraft build

Basic hinge reconstructed from the supplied native SolidCraft Hinge Assembly. Two identical 40 × 30 × 3 mm leaves each carry a Ø8 × 40 mm knuckle along X. Leaf A remains grounded while Leaf B is connected by a native revolute joint named Hinge, starting at 60° with 0–180° limits.

Key dimensions: 40 × 30 × 3 mm leaves; Ø8 × 40 mm knuckles; 60° initial angle; 0–180° joint limits

Open in SolidCraft Web

The editable .sc model is loaded directly from the accepted build branch.

Background

A compact two-leaf hinge reconstructed from the supplied SolidCraft design.

Both leaves use the same 40 × 30 × 3 mm plate and Ø8 × 40 mm knuckle geometry. The hinge opens around the shared X-axis and the supplied design starts at 60°, with a permitted range of 0° to 180°.

The generated model is intended to retain that movement as a real SolidCraft revolute joint rather than as a fixed rotated copy.

SCPF source

The exact SCPF Python source declared by this build variant.

scpf/model.py
"""Basic two-leaf hinge reconstructed from the supplied SolidCraft source.

The source owns two identical components (Leaf A / Leaf B) joined by a native
revolute relationship. Each source leaf contains a 40 x 30 x 3 mm box and a
separate Ø8 x 40 mm cylinder. They overlap physically, so Forge joins those
primitive bodies inside one reusable leaf definition while preserving the
important source ownership boundary: two independent leaf occurrences and one
native driveable hinge joint.
"""

from scpf import (
    Anchor,
    AnchorFrame,
    Axis,
    Box,
    Cylinder,
    component,
)


@component(include="*")
class HingeLeaf:
    length = 40.0
    width = 30.0
    thickness = 3.0

    knuckle_diameter = 8.0
    knuckle_length = 40.0
    knuckle_y = 33.0
    knuckle_z = 4.0

    def anchors(self):
        return {
            "hinge_axis": AnchorFrame(
                origin=(0.0, 33.0, 4.0),
                z=(1.0, 0.0, 0.0),
                x=(0.0, 0.0, -1.0),
            ),
        }

    def build(self):
        plate = Box(
            self.length,
            self.width,
            self.thickness,
            anchor=Anchor.BOTTOM,
        ).at(
            self.length / 2,
            self.width / 2,
            0.0,
            anchor=Anchor.BOTTOM,
        )

        knuckle = Cylinder(
            d=self.knuckle_diameter,
            h=self.knuckle_length,
            axis=Axis.X,
            anchor=Anchor.LEFT,
        ).at(
            0.0,
            self.knuckle_y,
            self.knuckle_z,
            anchor=Anchor.LEFT,
        )

        return plate + knuckle


class Hinge:
    _initial_angle = 60.0
    _minimum_angle = 0.0
    _maximum_angle = 180.0

    def build(self):
        leaf_a = HingeLeaf(name="LeafA")
        leaf_b = HingeLeaf(name="LeafB").attach(
            leaf_a,
            parent="hinge_axis",
            child="hinge_axis",
            kind="revolute",
            value=self._initial_angle,
            limits=(self._minimum_angle, self._maximum_angle),
            name="Hinge",
        )
        return leaf_a + leaf_b


Hinge()
SolidCraft command sequence 14 generated operations · expand to inspect
  1. parameters.add
    {
       "expression": "40",
       "name": "d1_HingeLeaf_length",
       "unit": "mm"
    }
    
  2. parameters.add
    {
       "expression": "30",
       "name": "d1_HingeLeaf_width",
       "unit": "mm"
    }
    
  3. parameters.add
    {
       "expression": "3",
       "name": "d1_HingeLeaf_thickness",
       "unit": "mm"
    }
    
  4. parameters.add
    {
       "expression": "40",
       "name": "d1_HingeLeaf_knuckle_length",
       "unit": "mm"
    }
    
  5. parameters.add
    {
       "expression": "8",
       "name": "d1_HingeLeaf_knuckle_diameter",
       "unit": "mm"
    }
    
  6. parameters.add
    {
       "expression": "33",
       "name": "d1_HingeLeaf_knuckle_y",
       "unit": "mm"
    }
    
  7. parameters.add
    {
       "expression": "4",
       "name": "d1_HingeLeaf_knuckle_z",
       "unit": "mm"
    }
    
  8. component.create
    {
       "grounded": true,
       "name": "HingeLeaf"
    }
    
  9. solid.box
    {
       "body_name": "HingeLeaf",
       "corner": [
          "(d1_HingeLeaf_length / 2) + (-(d1_HingeLeaf_length / 2))",
          "(d1_HingeLeaf_width / 2) + (-(d1_HingeLeaf_width / 2))",
          0
       ],
       "height": "d1_HingeLeaf_thickness",
       "length": "d1_HingeLeaf_length",
       "operation": "new",
       "width": "d1_HingeLeaf_width"
    }
    
  10. solid.cylinder
    {
       "axis": "X",
       "base": [
          0,
          "d1_HingeLeaf_knuckle_y",
          "d1_HingeLeaf_knuckle_z"
       ],
       "diameter": "d1_HingeLeaf_knuckle_diameter",
       "height": "d1_HingeLeaf_knuckle_length",
       "operation": "join",
       "targets": [
          "HingeLeaf"
       ]
    }
    
  11. component.activate
    {
       "component": "root"
    }
    
  12. occurrence.copy
    {
       "component": "HingeLeaf"
    }
    
  13. joint.create
    {
       "a": {
          "occurrence": "$leafa",
          "point": [
             0,
             33,
             4
          ],
          "x": [
             0,
             0,
             -1
          ],
          "z": [
             1,
             0,
             0
          ]
       },
       "b": {
          "occurrence": "$leafb",
          "point": [
             0,
             33,
             4
          ],
          "x": [
             0,
             0,
             -1
          ],
          "z": [
             1,
             0,
             0
          ]
       },
       "limits": [
          [
             0,
             180
          ]
       ],
       "name": "Hinge",
       "type": "revolute",
       "values": [
          60
       ]
    }
    
  14. browser.visibility
    {
       "folder": "joints",
       "visible": false
    }
    

Build information

Build scope
main
Build variant
hinge
Physical owner
hinge
Built source
1f2fdb32d67d9af42779500c949f2900ee59c7ae
Forge
v0.23.0 ·
SolidCraft
0.49.0
Runtime
ghcr.io/brainboxemb/cad-solidcraft:v0.3.6