The MiddlePath node can be used to get the middle path of a pipe-like shape or loft or the middle offset path of a planar face.

Middle path of pipe

Provide the shape and two faces or wires that are the start and stop of the path in the shapes list or as children of the node.

# Created in DeclaraCAD
from declaracad.occ.api import *
from declaracad.parts.display import Axis


enamldef Assembly(Part):
    Axis:
        pass
    Loft: s:
        transparency = 0.8
        color = 'blue'
        solid = True
        Circle:
            radius = 2
        Ellipse:
            position = (0, -1, 4)
            major_radius = 3
            minor_radius = 2        
        Circle:
            position = (0, 2, 10)
            radius = 3

    MiddlePath:
        color = 'red'
        shapes = [s, s.topology.faces[1], s.topology.faces[2]]

Middle path

Planar Middle path

If the first child or first item in the shapes list is a face the MiddlePath node will generate a compund with paths equally distant from the edges as shown below.

# Created in DeclaraCAD
from declaracad.occ.api import *
from declaracad.parts.display import Axis


enamldef Assembly(Part):
    Axis:
        pass
    Cut: slot:
        color = '#abc'
        transparency = 0.8
        Box:
            position = (-dx/2, -dy/2)
            dx = 50
            dy = 100
            dz = 2
        Box:
            position = (-dx/2, -dy/2, 1)
            dx = 10
            dy = 80
            dz = 1
    MiddlePath:
            shapes = slot.topology.faces[10:11]

DeclaraCAD middle path