import { Canvas, useLoader, useFrame } from '@react-three/fiber' import { Suspense } from 'react' import { Html, Stats } from '@react-three/drei' import CadPackage, { CadPackageType, } from 'src/components/CadPackage/CadPackage' import { navigate, routes, Link } from '@redwoodjs/router' import { useInView } from 'react-intersection-observer' import Svg, { SvgNames } from 'src/components/Svg/Svg' import Gravatar from 'src/components/Gravatar/Gravatar' import ProjectsCell from 'src/components/ProjectsCell' import OutBound from 'src/components/OutBound/OutBound' // dynamic import to enable pre-render iof the homepage const AssetWithGooey = React.lazy( () => import('src/components/Hero/AssetWithGooey') ) const cqCode = `from cadquery import * d1 = 58.5 d2 = 56.5 d3 = 63.5 d4 = 84 d5 = 88 h1 = 8.5 h2 = 154 l1 = 14.5 l2 = 4.5 cup = ( Workplane("XY").circle(d1 / 2).extrude(h1) .faces(">Z").circle(d3 / 2) .workplane(offset=h2).circle(d5 / 2) .loft() .cut(Workplane("XY") .circle((d3 - 3.5) / 2) .workplane(offset=h2).circle((d5 - 3.5) / 2) .loft() .translate([0, 0, h1]) ) `.split('\n') const scadCode = `hingeHalfExtrudeLength=hingeLength/2-clearance/2; mountingHoleMoveIncrement=(hingeLength-2*mountingHoleEdgeOffset)/ (mountingHoleCount-1); module costomizerEnd() {} $fn=30; tiny=0.005; // modules module hingeBaseProfile() { translate([pivotRadius,0,0]){ square([baseWidth,baseThickness]); } } module hingeBodyHalf() { difference() { union() { linear_extrude(hingeHalfExtrudeLength){ offset(1)offset(-2)offset(1){ translate([0,pivotRadius,0]){ circle(pivotRadius); } square([pivotRadius,pivotRadius]); hingeBaseProfile(); } } linear_extrude(hingeLength){ offset(1)offset(-1)hingeBaseProfile(); } } plateHoles(); } }`.split('\n') export const Hero = () => { return (
              {cqCode.map((line, index) => (
                
{index + 1} {line}
))}
Coffee Lid
IrevDev
Code
is the future of CAD
Designs backed by reliable, easy-to-write code open a world of new workflows and collaboration. We're building a place where you can build that future.
navigate(routes.draftProject({ cadPackage: 'openscad' })) } > Start Hacking
              {scadCode.map((line, index) => (
                
{index + 1} {line}
))}
Learn Code-CAD

We want you to learn Code-CAD today so it can change the way you work tomorrow. Our community is writing tutorials to make this powerful paradigm more accessible to people new to code and CAD.

Get Started with OpenSCAD
Print in Place Hinge
IrevDev
) } const DisableRender = () => useFrame(() => null, 1000) function ModelSection({ assetUrl, scale, }: { assetUrl: string scale: number }) { const { ref, inView } = useInView() return (
{!inView && } } > {/* uncomment for framerate and render time */} {/* */} {/* */}
) } function ChooseYourCharacter() { return (
Choose your character

CadHub is the place you can try out Code-CAD packages to find the one that's right for you. Our dedicated community is making CAD easy to learn on the web. Try one of our three integrations today and keep an eye out for more.

    {[ { cadPackage: 'openscad', desc: 'A mature Code-CAD library focused on Constructed Solid Geometry (CSG) modeling with syntax like C++.', }, { cadPackage: 'cadquery', desc: 'A Python-based library with support for CSG and sketch-based modeling and a clean-feeling API.', }, { cadPackage: 'jscad', desc: 'A JavaScript Code-CAD library that will feel familiar to web developers, based on the same tech as OpenSCAD.', }, ].map( ({ cadPackage, desc, }: { cadPackage: CadPackageType desc: string }) => (
  • {desc}

  • ) )}
) } function Community() { return (
Explore with our community

CadHub is a social platform. You can ask users how they designed a part, fork their work to put your own spin on it, and find inspiration in abundance.

navigate(routes.projects())} > See All Projects
) } function OutlineButton({ color, svgName, isLeft = false, children, onClick, }: { color: 'blue' | 'pink' | 'purple' svgName: SvgNames isLeft?: boolean children: React.ReactNode onClick?: () => void }) { return ( ) } function Roadmap() { const sections = [ { title: 'Read our roadmap', desc: 'Version control with GitHub, multi-file projects, and team collaboration tools. We’ve got a lot planned, and we’re building it in the open.', buttonText: 'View on Github', color: 'purple', url: 'https://github.com/Irev-Dev/cadhub/discussions/212', }, { title: 'Join our community', desc: 'CAD is ready to evolve. Join our Discord and opensource community on GitHub and build that future with us!', buttonText: 'Join the Discord', color: 'blue', url: 'https://discord.gg/SD7zFRNjGH', }, ] return (
{sections.map(({ title, desc, buttonText, color, url }) => (
{title}

{desc}

{buttonText}
))}
) } function Footer() { const section: { header: string links: { name: string; url: string }[] }[] = [ { header: 'Community', links: [ { name: 'Github', url: 'https://github.com/Irev-Dev/cadhub', }, { name: 'Discord', url: 'https://discord.gg/SD7zFRNjGH', }, { name: 'Newsletter', url: 'https://kurthutten.com/signup/', }, ], }, { header: 'About', links: [ { name: 'Road Map', url: 'https://github.com/Irev-Dev/cadhub/discussions/212', }, { name: 'Code of Conduct', url: '/policies/code-of-conduct', }, { name: 'Privacy Policy', url: '/policies/privacy-policy', }, ], }, { header: 'Learn', links: [ { name: 'Documentation', url: 'https://learn.cadhub.xyz/', }, { name: 'Blog', url: 'https://learn.cadhub.xyz/blog', }, ], }, { header: 'Integrations', links: [ { name: 'OpenSCAD', url: 'https://openscad.org/', }, { name: 'CadQuery', url: 'https://cadquery.readthedocs.io/en/latest/', }, { name: 'JSCAD', url: 'https://github.com/jscad', }, ], }, ] return (
{/* Because of how specific these styles are to this heading/logo and it doesn't need to be replicated else where as well as it's very precise with the placement of "pre-alpha" I think it's appropriate. */}

CadHub

pre-alpha

Built by{' '} 16 contributors {' '} from around the world.

{section.map(({ header, links }) => (
  • {header}
  • {links.map(({ name, url }) => (
  • {name}
  • ))}
))}
) }