mcad

package module
v0.0.0-...-7289e16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2023 License: MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

mcad - Port of openscad/mcad to lestrrat-go/openscad

Use openscad.WriteFile (or EmitFile or Emit) to generate the appropriate files

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auger

func Auger() openscad.Stmt

func BallGroove

func BallGroove() openscad.Stmt

func BallGroove2

func BallGroove2() openscad.Stmt

func Constants

func Constants() openscad.Stmt

func Curves

func Curves() openscad.Stmts

func Deg

func Deg() openscad.Stmt

func Helix

func Helix() openscad.Stmt

func Math

func Math() openscad.Stmt

func Screw

func Screw() openscad.Stmt
Example
package main

import (
	"fmt"
	"os"

	"github.com/lestrrat-go/openscad"
)

func main() {
	if err := openscad.EmitFile("screw.scad", os.Stdout); err != nil {
		fmt.Printf("%s\n", err)
		return
	}
}
Output:
include <curves.scad>

module helix(pitch, length, slices=500)
{
  rotations=length/pitch;
  linear_extrude(height=length, center=false, convexity=10, twist=360*rotations, scale=slices, $fn=100)
    children();
}

module auger(pitch, length, outside_radius, inner_radius, taper_ratio=0.25)
{
  union()
  {
    helix(pitch, length)
      polygon(points=[[0, inner_radius], [outside_radius, inner_radius*taper_ratio], [outside_radius, inner_radius*-1*taper_ratio], [0, -1*inner_radius]], paths=[[0, 1, 2, 3]]);
    cylinder(h=length, r=inner_radius);
  }
}

module ball_groove(pitch, length, diameter, ball_radius=10)
{
  helix(pitch, length, 100)
    translate([diameter, 0, 0])
      circle(r=ball_radius);
}

module ball_groove2(pitch, length, diameter, ball_radius, slices=200)
{
  rotations=length/pitch;
  radius=diameter/2;
  offset=length/slices;
  union()
    for(i=[0:slices]) {
      let(z=i*offset)
        translate(helix_curve(pitch, radius, z))
          sphere(r=ball_radius, $fa=5, $fs=1);
    }
}

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址