Skip to content

Optional half-nodes #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 40 additions & 6 deletions nodes_graph.scad
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ _CircInsideQuads = true;
// Quad Inset
_CircQuadInset = 7;

// Half-nodes at start and end
_CircHalfNodes = false;

/* [Axial Rays] */

// Linear step between nodes
Expand Down Expand Up @@ -212,10 +215,13 @@ module NodeGuts(NodeShape, Radius, Height, RimHeight)
//
// Node:
//
// Render a node, with a rim and optional hole for magnet.
// Render a node, with a rim and optional hole for magnet.
//
// PlusX must be true to render the part of the node at X > 0
// MinuxX must be true to render the part of the node at X < 0
//

module Node(NodeShape, Radius, Height, RimHeight, MagnetHole)
module Node(NodeShape, Radius, Height, RimHeight, MagnetHole, PlusX=true, MinusX=true)
{
// Node rotation
NodeRotation = (_NodeShape == 0) ? 0 : /* Circle */
Expand All @@ -230,11 +236,29 @@ module Node(NodeShape, Radius, Height, RimHeight, MagnetHole)
NodeGuts(NodeShape, Radius, Height, RimHeight);
}

/* Antimatter */
/* Antimatter magnet hole */
translate([0, 0, 0.4])
{
Hole(MagnetHole);
}

/* Optionally remove +Y half */
if (!PlusX)
{
translate([-Radius, 0, 0])
{
cube([2 * Radius, Radius, Height + RimHeight]);
}
}

/* Optionally remove -Y half */
if (!MinusX)
{
translate([-Radius, -Radius, 0])
{
cube([2 * Radius, Radius, Height + RimHeight]);
}
}
}
}

Expand Down Expand Up @@ -445,10 +469,15 @@ module Quad(X0, Y0, X1, Y1, X2, Y2, X3, Y3, Inset, Height, RimHeight)
//
// Partial or full circle, with optional node at the center, then rings of nodes,
// connected radially and cicularly, with optional quadrilaterals between nodes.
//
// If HalfNodes is set, then the first and last nodes in the ring are PlusX half
// only. This makes it easier to print a pair of semi-circular rings that can be
// joined with straight pieces.
//
// TODO: Add parameters
//

module CircularRays(StartRing, RingCount, RingSpace, Step, Limit, Center, InsideQuads, QuadInset, NodeShape, NodeSize, NodeHeight, NodeMagnetHole)
module CircularRays(StartRing, RingCount, RingSpace, Step, Limit, Center, InsideQuads, QuadInset, NodeShape, NodeSize, NodeHeight, NodeMagnetHole, HalfNodes)
{
if (Center)
{
Expand All @@ -466,7 +495,12 @@ module CircularRays(StartRing, RingCount, RingSpace, Step, Limit, Center, Inside

translate([RingX, RingY, 0])
{
Node(NodeShape, NodeSize, NodeHeight, NodeRimHeight, NodeMagnetHole);
MinusXHalf =
(!HalfNodes)
||
(HalfNodes && (Theta > 0) && (Theta < Limit));

Node(NodeShape, NodeSize, NodeHeight, NodeRimHeight, NodeMagnetHole, true, MinusXHalf);
}
}
}
Expand Down Expand Up @@ -898,7 +932,7 @@ module Hexagon(BaseWidth, InsideTriangles, TriangleInset, NodeShape, NodeSize, N

if (_Pattern == "Circular")
{
CircularRays(_CircStartRing,_CircRingCount, _CircRingSpace, _CircRayStep, _CircRayLimit, _CircRayCenter, _CircInsideQuads, _CircQuadInset, _NodeShape, _NodeSize, _NodeHeight, _NodeMagnetHole);
CircularRays(_CircStartRing,_CircRingCount, _CircRingSpace, _CircRayStep, _CircRayLimit, _CircRayCenter, _CircInsideQuads, _CircQuadInset, _NodeShape, _NodeSize, _NodeHeight, _NodeMagnetHole, _CircHalfNodes);
}

else if (_Pattern == "Axial")
Expand Down