planex2d

About

  • Installation
    • The core and the OpenCASCADE bindings
    • Optional packages
  • API conventions
    • Chaining and copies
    • Reading the arguments
    • Points
    • Planes
    • Angles and units
    • Queries
    • Errors and warnings
  • How planex2d is tested
    • Tests written by hand
    • Agentic testing
    • Fuzz tests
  • Building and contributing
    • Requirements
    • Build
    • Tests
    • Contributing
  • How AI is used in this project
    • Development
    • Documentation
    • Testing
  • License and notices
    • The documentation, examples and exercises
      • Code: 0BSD
      • Text and figures: CC BY-SA 4.0
      • Exercises: CC BY-NC-SA 4.0
    • Eigen 3.4.0
      • Licenses of the Eigen files planex2d compiles
    • pybind11
    • Taskflow 4.1.0
    • Libraries planex2d uses but does not include
    • Packages planex2d imports when they are installed
    • The lettering font osifont
    • Data files under other licenses
  • Roadmap
    • Installation
    • Selections and sketches
    • Constraints
    • Measuring
    • Files
    • OpenCASCADE

Core

  • Basics
    • Objects
      • Objects in planex2d
      • Lines and arcs
      • Splines
      • Parametric curves
      • Wires and faces
      • Faces, shapes and compounds
    • In space
      • The plane in 3D
      • Moving, rotating, mirroring, scaling
    • Data
      • Names and colors
      • Units
      • Tolerances
  • Plotting
    • General
      • matplotlib
      • plotly
      • SVG
      • Marking edges
      • In 3D
    • Sketches
      • Sketch plots
    • Measurements and fields
      • Measurements
      • Fields
    • Everything at a glance
  • Quick sketch
    • Drawing
      • Sketch or QuickSketch
      • Lines and arcs
      • Circles and rectangles
      • Slots, keyholes and polygons
      • Splines
      • Parametric curves
      • Several loops
    • References
      • To, from and until
      • Parallel, perpendicular, angle
      • Tangents
      • Arcs from references
      • Choosing between solutions
      • Construction elements and points
      • Automatic ids
    • Editing
      • Fillets and chamfers
      • Curvature-continuous blends
      • Extending edges
      • Offsets
      • Trimming and splitting
      • Symmetry
    • Placement
      • Placing a sketch
    • Design
      • Parametric design
    • Everything at a glance
  • Constraint sketches
    • Constraining
      • Drawing with constraints
      • Converting sketches
      • Auto constraints
      • Geometry checks
      • From a drawing to a parametric sketch
      • Constraints and dimensions
      • Fully, under- and over-constrained
    • Changing the design
      • Changing dimensions
      • Expressions: design rules
      • Formulas: a dipstick for a tank
      • Parameters shared by sketches
      • Curves driven by dimensions
    • More geometry
      • Symmetry and patterns
      • Splines
      • Trim, split and project
      • Offsets and profiles revisited
    • Beyond drawings
      • Mechanisms: the sketch as a solver
  • Boolean operations
    • Two faces
      • Three operations
      • Union
      • Difference and intersection
      • Names are kept
      • Symmetric difference
    • Many faces at once
      • A perforated sheet
      • A Reuleaux triangle
      • A stress test
    • Symmetric difference
      • Two revisions of a part
      • An eccentric bore
      • Many parts
    • Faces and wires
      • A truss from its member center lines
      • Glued, the members stay separate
      • Overlapping stretches are kept once
    • Splitting and trimming
      • A segmented ring
      • Trimming a blank
      • Closed cutters punch holes
      • Wires
      • Cutters from 3D
      • The rules
    • Traces and pads
      • Check
      • Pads and drills
    • Everything at a glance
  • 3D
    • Pad and Pocket
      • A clamp plate
      • Pockets from a sketch on the top face
      • Up to a face
      • Options
    • Everything at a glance
  • Measuring
    • Measurements
      • Areas, centroids and second moments
      • Boxes, crossings and open ends
      • Distances and clearances
      • Inside or outside
      • Relations between shapes
      • Dimensions in a sketch
    • Analysis
      • Part analysis
    • Everything at a glance
  • Drawings
    • A dimensioned drawing
      • The sketch
      • The drawing
      • After a change
    • Placing dimensions
      • Lengths
      • Radii and diameters
      • Counts and texts
      • Angles
    • Center lines and axes
      • Circles and bolt circles
      • The axis of a turned part
    • Views and sheets
      • Two views
      • Other views
      • Tables and notes
    • Title blocks and files
      • The title block
      • A company’s title block
      • Files
  • Files
    • STEP and BREP
      • A part on an inclined plane
      • Several parts
      • Files from other programs
      • Units
      • Export options
      • BREP
    • SVG files
      • Writing
      • Reading back
      • A drawing from another program
      • Units
    • DXF
      • A gasket drawing
      • Polylines with arcs
      • Units
      • Gaps
    • STEP and BREP
    • SVG
    • Shapely
    • KiCad
    • gmsh
  • Defeaturing and simplification
    • Small gaps
      • A square that does not close
      • On export and when reading
    • Small edges
      • A step of 10⁻⁵
      • On export
    • Collinear lines
      • A bottom in four pieces
    • Fitting arcs
      • A measured bore
      • Tolerance
      • On export
    • Fitting splines
      • An ellipse from 128 segments
      • Arcs first
    • The steps, in order
  • Comparison with other libraries
    • Union of many discs
    • Union of traces
    • Merging split edges
    • Nearly coincident edges
    • Gluing many faces

Integrations

  • OpenCASCADE
    • Export
      • To OCC shapes
      • Export options
      • Splines as arcs
    • Modeling
      • A C-clamp, step by step
      • Sketching on and projecting 3D geometry
      • Lofting sections
      • Lofts with guide curves
    • Everything at a glance
  • netgen and NGSolve
    • Getting started
      • Coming from netgen's WorkPlane
      • Naming and marking
      • Identifications
    • Meshing and fields
      • Meshing a face
      • Fields and cuts
      • Solids and meshes in the webgui
      • Field solvers as measurements
      • From level sets
  • gmsh and FEniCSx
    • A minimal example
    • A trimmed resistor
    • The mesh
    • The resistance
    • Drawing the result
    • More
  • Shapely
    • A minimal example
    • To Shapely
    • Predicates and distances
    • From Shapely and back to arcs
    • Line strings
  • SciPy
    • A minimal example
    • A dimension from a requirement
    • Optimizing a cold plate
    • Fitting a sketch to measured points
    • At a glance
    • In 3D
      • A 3D cold plate
  • PyTorch
    • A minimal example
    • The plate and its two measurements
    • The baseline: COBYLA from the regular grid
    • 40 layouts that fill the space
    • The surrogate
    • Search the model, solve the winners
    • Polish the winner
    • More
    • In 3D
      • A 3D duct
  • KiCad, Altium, Eagle and more
    • KiCad
      • A minimal example
      • A real board
      • Both copper layers
      • What the board looks like
      • Copper per net
      • A clearance check
      • The board in 3D
      • Writing a board
      • Older KiCad boards
    • Altium
      • The board
      • Four copper layers
      • The gaps of the split plane
      • The board in 3D
    • Eagle
      • The board
      • Copper per net
      • A check against the DIP grid
      • The board in 3D
    • EasyEDA
      • The board
      • Copper per net
      • A check against the connector grid
    • PADS
      • The board
      • Copper per net
      • A check against the Pico’s pin grid
    • Other formats
      • SolidWorks PCB
      • Cadence Allegro
      • CADSTAR
      • Fabmaster
      • P-CAD
      • gEDA and Lepton EDA
  • NumPy
    • A minimal example
    • Arrays in
    • Arrays out
    • A million points at once
    • Construction data
    • More

Examples

  • Machines and vehicles
    • Toy plane
    • Model rocket
    • Rear wing with DRS
    • Suspension kinematics
    • Excavator arm
    • Spur gears under load
    • Planetary gearbox
    • Wankel engine
    • Scroll compressor
  • Mechanisms
    • Four-bar linkage
    • Hood hinge
    • Jansen linkage
    • Straight-line linkages
    • Geneva drive
    • Cycloidal drive
    • Belt drives
    • Drilling a square hole
    • The haberdasher's puzzle
    • Bicycle tracks
    • Ackermann steering
  • Physics
    • Isospectral drums
    • The Helmholtz resonator
    • Chladni figures
    • Boat stability
    • Flow through sand
    • Solar shading
    • The catenary arch
    • Euler buckling
    • The stress intensity factor of a crack
    • Mirrors from conic sections
    • The fastest slide
    • Transition curves
  • Fields and simulation
    • Surface magnet motor
    • Heat sink
    • Hilbert heater
    • Parallelogram flexure
    • Vivaldi antenna
    • Voronoi bone
    • Lens ray tracing
    • Airplane windows
    • The Tesla valve
    • The Venturi meter
    • The hydraulic diameter
    • The Joukowski airfoil
    • Microstrip impedance
    • The Faraday cage
    • Sharp or blunt lightning rods
    • The skin effect
    • Waveguide cutoff
    • A photonic crystal
    • Stress at a shoulder fillet
    • Open and closed sections in torsion
    • The Halbach array
  • Manufacturing
    • Gear cutting
    • Pocket milling
    • A slicer for 3D printing
    • Laser-cut box
    • Stencil lettering
  • Geometry and design
    • Penrose tiling
    • Rose window
    • Path planning
    • The moving sofa
    • Prince Rupert's cube
    • The coastline paradox
    • The pole of inaccessibility
    • Section properties of steel profiles
    • The spirograph
    • The Hausdorff distance
    • The isoperimetric inequality
    • The lune of Hippocrates
    • Circle packing in a square
    • The problem of Apollonius
    • Drawing a logo
    • Why bees build hexagons
    • Vaults and Steinmetz solids
    • Gabriel's horn
    • Buffon's needle
    • Pick's theorem
    • The Steiner tree problem
    • Sunflower seeds and the golden angle

Exercises

  • 2D exercises
    • Crane hook
    • Lever
    • Flange gasket
    • Lobed gasket
    • Chain link plate
    • Keyed hub
    • Circular-arc cam
    • Bell crank
    • Vent plate
    • Adjusting plate
    • Nut retainer
    • Wall hanger
    • Motor mount plate
    • Spring clip
    • Ratchet wheel
    • Open-end spanner
    • Lifting lug
    • Ratchet pawl
    • Chain sprocket
    • Disc cam
    • Flange series
    • Gear pump gasket
  • 3D exercises
    • Pillow block
    • Guide block
    • Angle bracket
    • Step block
    • Inclined block
    • V-belt pulley
    • Corner block
    • Column base
    • Clevis
    • Fork lever
    • Rocker
    • Saddle support
    • Stepped shaft
    • Spur gear
    • Impeller
    • Square-to-round transition
    • Elbow duct
    • Impeller with twisted blades
    • Hex standoff
    • Control knob
    • Split shaft collar
    • Electronics enclosure
    • Connecting rod
    • Manifold block
    • Sheet-metal bracket
    • Compression spring
    • Pipe flange
    • Handwheel
    • Gear pump cover
    • Gear pump housing
    • Gear pump rotors

Experimental

  • Deformable shapes
    • Displacements and topology changes
      • Moving the hole up
      • What happens at a topology change
      • Results
    • Displacements from NGSolve
      • A harmonic extension
      • In motion

API

  • API reference
    • Geometry
      • Edges and wires
      • Faces, shapes and compounds
      • Planes
    • Sketches
      • Constraints and dimensions
      • References
    • Boolean operations and transformations
      • Offset ends and corners
    • Selections and views
      • Coordinates and axes
    • Files and other libraries
      • Modules
    • OpenCASCADE and netgen
    • Plotting and drawings
      • Drawings
    • Measurements
    • Units, settings and warnings
      • Units
      • Modules
    • Experimental
planex2d
  • Exercises
  • Chain link plate
  • View page source

Chain link plate

A chain link plate joins two pins of a roller chain. It has two eyes around the pin holes and a waist between them whose flanks are arcs tangent to both eyes. Model the plate from the drawing in planex2d or in any CAD system, then check its area and centroid against the values at the end of the page. A solution in planex2d follows.

The chain link plate exercise: a dimensioned drawing of a plate with two eyes and a waist of two concave arcs

[1]:
import math
import planex as px

The circles

The plate is drawn on four circles, the two eyes, of radius 15 and 50 apart, and the two flanks, of radius 40, each tangent to both eyes, one above the axis and one below it. reverse=True picks the flank below. With auto_constraint=True, the flanks stay tangent to the eyes when a dimension changes (Figure 1).

[3]:
plate = px.Sketch(auto_constraint=True)
plate.Circle(15, id="left_eye")
plate.Circle(15, center=(50, 0), id="right_eye")
plate.Circle(40, id="upper_flank", tangent=("left_eye", "right_eye"))
plate.Circle(40, id="lower_flank", tangent=("left_eye", "right_eye"), reverse=True)
print("upper flank center", tuple(round(v, 3) for v in plate.Location("upper_flank.center")))
upper flank center (25.0, 48.99)
The eyes and the two flanks tangent to them (rotated 90 degrees)
Figure 1: The circles, their centers marked (rotated 90 degrees)

Trimming

Each circle is cut where it touches the others, and Trim turns the piece nearest to a point into construction. That is the inner piece of each eye, toward the other eye, and the outer piece of each flank, away from the plate. What stays is the outline. The pin holes of 12 go around the centers of the eyes (Figure 2).

[5]:
plate.Trim(("left_eye", (20, 0)))  # the piece nearest to (20, 0), the inner one, becomes construction
plate.Trim(("right_eye", (30, 0)))
plate.Trim(("upper_flank", (25, 100)))
plate.Trim(("lower_flank", (25, -100)))
plate.Circle(6, concentric="left_eye", id="left_hole")
plate.Circle(6, concentric="right_eye", id="right_hole");
The outline, the trimmed pieces dashed (rotated 90 degrees)
Figure 2: The trimmed outline (rotated 90 degrees)

The dimensions

The left eye’s center is the origin, and the right eye’s center lies on the horizontal axis. The second eye, the second flank and the second hole are equal to the first ones, so the sketch carries each size once, as the drawing gives it. With these, nothing in the sketch is left free (Figure 3):

[7]:
plate.Constrain("left_eye.center", "origin", px.Coincident)
plate.Constrain("right_eye.center", "H", px.Coincident)
plate.Constrain("left_eye.center", "right_eye.center", px.Distance, 50, id="pitch")
plate.Constrain("left_eye", px.Radius, 15, id="eye_r")
plate.Constrain("right_eye", "left_eye", px.Equal)
plate.Constrain("upper_flank", px.Radius, 40, id="flank_r")
plate.Constrain("lower_flank", "upper_flank", px.Equal)
plate.Constrain("left_hole", px.Diameter, 12, id="hole_d")
plate.Constrain("right_hole", "left_hole", px.Equal)
print("status", plate.status, "| degrees of freedom", plate.dof)
status full | degrees of freedom 0
Every dimension and tie of the sketch
Figure 3: The fully constrained sketch

The checks

These are the area and the centroid of the plate, with the left eye’s center at the origin, to compare with your own model. The plate is symmetric about the axis and about the middle between the eyes, so its centroid lies at that middle (Figure 4):

[9]:
face = plate.Face()
c = face.center
print("area", round(face.mass, 2), "mm²")
print("centroid", round(c[0], 2), "on the axis, off it by", round(abs(c[1]), 6))
area 1632.53 mm²
centroid 25.0 on the axis, off it by 0.0
The plate, its centroid marked
Figure 4: The plate

The plate as DXF in millimeters, for another CAD system or a laser cutter:

[11]:
plate.WriteDXF("chain_plate.dxf", unit=px.mm, scale=1)  # scale=1: the numbers as they are

The plate as DXF: chain_plate.dxf

Previous Next

© 2026 Sebastian Hirnschall · Imprint · Privacy · License · GitHub · PyPI

Built with Sphinx using a theme provided by Read the Docs.