repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/washers.py | src/cqparts_fasteners/washers.py | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false | |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/bolts.py | src/cqparts_fasteners/bolts.py |
from cqparts.params import *
from .male import MaleFastenerPart
from .params import *
class Bolt(MaleFastenerPart):
length = PositiveFloat(20, doc="length from xy plane to tip")
head = HeadType(
default=('hex', {
'width': 8,
'height': 3.0,
}),
doc="head type ... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/nuts.py | src/cqparts_fasteners/nuts.py |
from cqparts.params import *
from .female import FemaleFastenerPart
class SquareNut(FemaleFastenerPart):
edges = PositiveInt(4, doc="number of sides")
class HexNut(FemaleFastenerPart):
edges = PositiveInt(6, doc="number of sides")
class HexFlangeNut(FemaleFastenerPart):
edges = PositiveInt(6, doc="n... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/female.py | src/cqparts_fasteners/female.py |
from .params import *
from .solidtypes.fastener_heads.driven import DrivenFastenerHead
from cqparts.params import *
class FemaleFastenerPart(DrivenFastenerHead):
"""
Female fastener part; with an internal thread.
A female fastener part can only be externally driven, which is why this
object inherit... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/__init__.py | src/cqparts_fasteners/__init__.py | """
Copyright 2018 Peter Boin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distrib... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/screws.py | src/cqparts_fasteners/screws.py |
from cqparts.params import *
from .male import MaleFastenerPart
from .params import HeadType, DriveType, ThreadType
from .solidtypes import threads
import logging
log = logging.getLogger(__name__)
class Screw(MaleFastenerPart):
"""
Part representing a single screw
"""
head = HeadType(
defa... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/male.py | src/cqparts_fasteners/male.py | from math import tan, radians
import cadquery
import cqparts
from cqparts.params import *
from cqparts.utils import CoordSystem
from .solidtypes import threads
from .params import *
import logging
log = logging.getLogger(__name__)
class MaleFastenerPart(cqparts.Part):
r"""
Male fastener part; with an exte... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/catalogue/scripts/boltdepot.py | src/cqparts_fasteners/catalogue/scripts/boltdepot.py | #!/usr/bin/env python
import os
import sys
import inspect
import scrapy
import scrapy.crawler
import scrapy.exporters
import re
import argparse
import logging
import fnmatch
import json
import csv
import itertools
import six
import progressbar
# cqparts
import cqparts
# cqparts_fasteners
import cqparts_fasteners
imp... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/catalogue/scripts/bunnings.py | src/cqparts_fasteners/catalogue/scripts/bunnings.py | #!/usr/bin/env python
import os
import inspect
import scrapy
import scrapy.crawler
import scrapy.exporters
import re
import argparse
import logging
import fnmatch
import json
import csv
# ---------- Utilities ----------
def split_url(url):
match = re.search(r'^(?P<base>.*)\?(?P<params>.*)$', url, flags=re.I)
... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/solidtypes/__init__.py | src/cqparts_fasteners/solidtypes/__init__.py | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false | |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/solidtypes/threads/iso68.py | src/cqparts_fasteners/solidtypes/threads/iso68.py | import cadquery
from math import pi, sin, cos, tan, sqrt
from cqparts.params import *
from .base import Thread, register
@register(name='iso68')
class ISO68Thread(Thread):
"""
.. image:: /_static/img/threads/iso68.png
"""
# rounding ratio:
# 0.0 = no rounding; peaks and valeys are flat
# ... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/solidtypes/threads/__init__.py | src/cqparts_fasteners/solidtypes/threads/__init__.py | __all__ = [
'Thread', 'register', 'find', 'search',
# Thread Types
'ball_screw',
'iso68',
'triangular',
]
from .base import Thread, register, find, search
# Thread Types
from . import ball_screw
from . import iso68
from . import triangular
| python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/solidtypes/threads/ball_screw.py | src/cqparts_fasteners/solidtypes/threads/ball_screw.py | import cadquery
from cqparts.params import *
from .base import Thread, register
@register(name='ball_screw')
class BallScrewThread(Thread):
"""
.. image:: /_static/img/threads/ball_screw.png
"""
ball_radius = Float(0.25, doc="ball's radius")
def build_profile(self):
"""
.. image:... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/solidtypes/threads/base.py | src/cqparts_fasteners/solidtypes/threads/base.py | import six
from math import ceil, sin, cos, pi
import os
import cadquery
import FreeCAD
import Part as FreeCADPart
import cqparts
from cqparts.params import *
from cqparts.errors import SolidValidityError
import logging
log = logging.getLogger(__name__)
# Creating a thread can be done in a number of ways:
# - cr... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/solidtypes/threads/triangular.py | src/cqparts_fasteners/solidtypes/threads/triangular.py | import cadquery
from math import radians, tan
from cqparts.params import *
from .base import Thread, register
@register(name='triangular')
class TriangularThread(Thread):
"""
.. image:: /_static/img/threads/triangular.png
"""
diameter_core = Float(None, doc="diamter of core")
angle = PositiveFlo... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/solidtypes/fastener_heads/counter_sunk.py | src/cqparts_fasteners/solidtypes/fastener_heads/counter_sunk.py | import cadquery
from math import pi, cos, sin, sqrt
from cqparts.params import *
from .base import FastenerHead, register
# pull FreeCAD module from cadquery (workaround for torus)
FreeCAD = cadquery.freecad_impl.FreeCAD
@register(name='countersunk')
class CounterSunkFastenerHead(FastenerHead):
"""
.. imag... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/solidtypes/fastener_heads/driven.py | src/cqparts_fasteners/solidtypes/fastener_heads/driven.py | import cadquery
from math import pi, cos, sin, sqrt
from cqparts.params import *
from .base import FastenerHead, register
class DrivenFastenerHead(FastenerHead):
chamfer = PositiveFloat(None, doc="chamfer value (default: :math:`d/15`)") # default to diameter / 10
chamfer_top = Boolean(True, doc="if chamfer... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/solidtypes/fastener_heads/__init__.py | src/cqparts_fasteners/solidtypes/fastener_heads/__init__.py | __all__ = [
'FastenerHead', 'register', 'find', 'search',
# Fastener Head Types
'counter_sunk',
'cylindrical',
'driven',
]
from .base import FastenerHead, register, find, search
# Fastener Head Types
from . import counter_sunk
from . import cylindrical
from . import driven
| python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/solidtypes/fastener_heads/base.py | src/cqparts_fasteners/solidtypes/fastener_heads/base.py | import six
import cadquery
# relative imports
import cqparts
from cqparts.params import *
import logging
log = logging.getLogger(__name__)
class FastenerHead(cqparts.Part):
diameter = PositiveFloat(5.2, doc="fastener head diameter")
height = PositiveFloat(2.0, doc="fastener head height")
# tool access
... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/solidtypes/fastener_heads/cylindrical.py | src/cqparts_fasteners/solidtypes/fastener_heads/cylindrical.py | import cadquery
from math import pi, cos, sin, sqrt
from cqparts.params import *
from .base import FastenerHead, register
class CylindricalFastenerHead(FastenerHead):
fillet = PositiveFloat(None) # defaults to diameter / 10
# Dome on top ?
domed = Boolean(False)
dome_ratio = PositiveFloat(0.25) # ... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/solidtypes/screw_drives/hex.py | src/cqparts_fasteners/solidtypes/screw_drives/hex.py | import cadquery
from math import sqrt, pi, sin, cos
from copy import copy
from cqparts.params import *
from .base import ScrewDrive, register
@register(name='hex')
@register(name='allen')
class HexScrewDrive(ScrewDrive):
"""
.. image:: /_static/img/screwdrives/hex.png
"""
diameter = PositiveFloat(No... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/solidtypes/screw_drives/square.py | src/cqparts_fasteners/solidtypes/screw_drives/square.py | import cadquery
from math import sqrt, pi, sin, cos
from copy import copy
from cqparts.params import *
from .base import ScrewDrive, register
@register(name='square')
@register(name='robertson')
class SquareScrewDrive(ScrewDrive):
"""
.. image:: /_static/img/screwdrives/square.png
"""
width = Positiv... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/solidtypes/screw_drives/slotted.py | src/cqparts_fasteners/solidtypes/screw_drives/slotted.py | import cadquery
from cqparts.params import *
from .base import ScrewDrive, register
@register(name='slot')
class SlotScrewDrive(ScrewDrive):
"""
.. image:: /_static/img/screwdrives/slot.png
"""
width = PositiveFloat(None, doc="slot width")
def initialize_parameters(self):
if self.width i... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/solidtypes/screw_drives/__init__.py | src/cqparts_fasteners/solidtypes/screw_drives/__init__.py | __all__ = [
'ScrewDrive', 'register', 'find', 'search',
# Screw Drive types
'cruciform',
'hex',
'slotted',
'square',
'tamper_resistant',
]
from .base import ScrewDrive, register, find, search
# Screw Drive types
from . import cruciform
from . import hex
from . import slotted
from . import... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/solidtypes/screw_drives/base.py | src/cqparts_fasteners/solidtypes/screw_drives/base.py | import six
import cadquery
import cqparts
from cqparts.params import *
from cqparts.utils import CoordSystem
class ScrewDrive(cqparts.Part):
diameter = PositiveFloat(3.0, doc="screw drive's diameter")
depth = PositiveFloat(None, doc="depth of recess into driven body")
def initialize_parameters(self):
... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/solidtypes/screw_drives/cruciform.py | src/cqparts_fasteners/solidtypes/screw_drives/cruciform.py | import cadquery
from cadquery import BoxSelector
from math import pi, cos, sqrt
from cqparts.params import *
from .base import ScrewDrive, register
@register(name='frearson')
class FrearsonScrewDrive(ScrewDrive):
"""
.. image:: /_static/img/screwdrives/frearson.png
"""
width = PositiveFloat(0.5)
... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/solidtypes/screw_drives/tamper_resistant.py | src/cqparts_fasteners/solidtypes/screw_drives/tamper_resistant.py | import cadquery
from cadquery import BoxSelector
from math import pi, cos, sqrt
from cqparts.params import *
from .base import ScrewDrive, register
class AcentricWedgesScrewDrive(ScrewDrive):
count = IntRange(1, None, 4)
width = PositiveFloat(0.5)
acentric_radius = PositiveFloat(None) # defaults to wid... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/fasteners/screw.py | src/cqparts_fasteners/fasteners/screw.py |
from cqparts.constraint import Mate, Coincident
from .base import Fastener
from ..screws import Screw
from ..utils import VectorEvaluator, Selector, Applicator
class ScrewFastener(Fastener):
"""
Screw fastener assembly.
Example usage can be found here: :ref:`cqparts_fasteners.built-in.screw`
"""
... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/fasteners/nutbolt.py | src/cqparts_fasteners/fasteners/nutbolt.py |
from cqparts.constraint import Mate, Coincident
from .base import Fastener
from ..utils import VectorEvaluator, Selector, Applicator
from ..nuts import HexNut
from ..bolts import HexBolt
class NutAndBoltFastener(Fastener):
"""
Nut and Bolt fastener assembly.
Example usage can be found here: :ref:`cqpar... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/fasteners/__init__.py | src/cqparts_fasteners/fasteners/__init__.py | __all__ = [
'Fastener',
]
from .base import Fastener
| python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/fasteners/base.py | src/cqparts_fasteners/fasteners/base.py | import six
from math import tan
from math import radians
import cadquery
import cqparts
from cqparts.params import *
from ..utils import Evaluator, Selector, Applicator
import logging
log = logging.getLogger(__name__)
# ----------------- Fastener Base ---------------
class Fastener(cqparts.Assembly):
# Paramet... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/utils/applicator.py | src/cqparts_fasteners/utils/applicator.py | from .evaluator import VectorEvaluator, CylinderEvaluator
class Applicator(object):
"""
The *applicator* performs 2 roles to *apply* a fastener to workpieces
#. Translate & rotate given *fastener*
#. Change workpieces to suit a given *fastener*
Translation is done first because the fastener is so... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/utils/evaluator.py | src/cqparts_fasteners/utils/evaluator.py | import cadquery
from copy import copy
import logging
from cqparts.utils import CoordSystem
from cqparts.utils.misc import property_buffered
from . import _casting
log = logging.getLogger(__name__)
# --------------------- Effect ----------------------
class Effect(object):
pass
class VectorEffect(Effect):
... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/utils/__init__.py | src/cqparts_fasteners/utils/__init__.py | __all__ = [
# Evaluators
'Evaluator',
'VectorEvaluator', 'CylinderEvaluator',
# Selectors
'Selector',
# Applicators
'Applicator',
]
# Evaluators
from .evaluator import Evaluator
from .evaluator import VectorEvaluator, CylinderEvaluator
# Selectors
from .selector import Selector
# Applic... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/utils/_casting.py | src/cqparts_fasteners/utils/_casting.py |
# Casting utilities are only intended to be used locally
# (ie: within the cqparts_fasteners.utils sub-modules).
# Each cast is designed to take a variety of inputs, and output
# the same class instance each time, or raise a fault
import cadquery
class CastingError(Exception):
"""
Raised if there's any prob... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_fasteners/utils/selector.py | src/cqparts_fasteners/utils/selector.py |
from .evaluator import Evaluator
class Selector(object):
"""
Facilitates the selection and placement of a *fastener's* components
based on an *evaluation*.
Each *selector* instance has an :class:`Evaluator` for reference,
and must have both the methods :meth:`get_components` and
:meth:`get_co... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_bearings/ball.py | src/cqparts_bearings/ball.py |
from math import pi, radians, sin, cos, asin
import cadquery
import cqparts
from cqparts.params import *
from cqparts import constraint
from cqparts.constraint import Mate
from cqparts.utils import CoordSystem
from . import register
class _Ring(cqparts.Part):
# Basic shape
outer_radius = PositiveFloat(10,... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_bearings/__init__.py | src/cqparts_bearings/__init__.py | """
Copyright 2018 Peter Boin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distrib... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_bearings/tapered_roller.py | src/cqparts_bearings/tapered_roller.py |
from math import pi, radians
from math import sin, cos, tan, asin, atan2
from math import sqrt
import cadquery
import cqparts
from cqparts.params import *
from cqparts import constraint
from cqparts.utils import CoordSystem
from . import register
class _InnerRing(cqparts.Part):
inner_diam = PositiveFloat(None... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_torquelimiters/sheer_pin.py | src/cqparts_torquelimiters/sheer_pin.py | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false | |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_torquelimiters/__init__.py | src/cqparts_torquelimiters/__init__.py | """
Copyright 2018 Peter Boin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distrib... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_torquelimiters/ball_detent.py | src/cqparts_torquelimiters/ball_detent.py | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false | |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_gears/trapezoidal.py | src/cqparts_gears/trapezoidal.py |
from math import pi, radians, sin, cos, acos
import cadquery
from cqparts.params import *
from cqparts.utils import CoordSystem
from cqparts.constraint import Mate
from .base import Gear
class TrapezoidalGear(Gear):
"""
Basic gear with trapezoidal tooth shape.
.. image:: /_static/img/gears/trapezoida... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_gears/__init__.py | src/cqparts_gears/__init__.py | """
Copyright 2018 Peter Boin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distrib... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_gears/base.py | src/cqparts_gears/base.py | import cadquery
import cqparts
from cqparts.params import *
class Gear(cqparts.Part):
effective_radius = PositiveFloat(25, doc="designed equivalent wheel radius")
tooth_count = PositiveInt(12, doc="number of teeth")
width = PositiveFloat(10, doc="gear thickness")
def make_simple(self):
return... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/search.py | src/cqparts/search.py | from collections import defaultdict
from copy import copy
from .errors import SearchMultipleFoundError, SearchNoneFoundError
# Search Index
# of the format:
# index = {
# <category>: {
# <value>: set([<set of classes>]),
# ... more values
# },
# ... mo... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/part.py | src/cqparts/part.py | import cadquery
import six
from copy import copy
from .params import Boolean
from .display.material import (
RenderParam,
TEMPLATE as RENDER_TEMPLATE,
)
from .errors import MakeError, ParameterError, AssemblyFindError
from .constraint import Constraint, Mate
from .utils.geometry import CoordSystem
import log... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/component.py | src/cqparts/component.py | from .params import ParametricObject
from .constraint import Mate
from .utils import CoordSystem
class Component(ParametricObject):
"""
.. note::
Both the :class:`Part` and :class:`Assembly` classes inherit
from ``Component``.
Wherever the term "*component*" is used, it is in referen... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/assembly.py | src/cqparts/assembly.py |
import six
import string
import re
from types import GeneratorType
from .component import Component
from .constraint import Constraint
from .constraint.solver import solver
from .utils.misc import indicate_last
from .utils.geometry import merge_boundboxes
from .errors import AssemblyFindError
import logging
log = ... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/errors.py | src/cqparts/errors.py |
# Build Exceptions
class ParameterError(Exception):
"""Raised when an invalid parameter is specified"""
class MakeError(Exception):
"""Raised when there are issues during the make() process of a Part or Assembly"""
# Internal Search Exceptions
class AssemblyFindError(Exception):
"""Raised when an assem... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/__init__.py | src/cqparts/__init__.py | """
Copyright 2018 Peter Boin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distrib... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/codec/gltf.py | src/cqparts/codec/gltf.py | import os
import struct
import base64
from io import BytesIO
from itertools import chain
from copy import copy, deepcopy
import json
from collections import defaultdict
import numpy
from cadquery import Vector
from . import Exporter, register_exporter
from .. import __version__
from .. import Component, Part, Assembl... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/codec/svg.py | src/cqparts/codec/svg.py |
import re
import cadquery
from . import Exporter, register_exporter
from .. import Part
@register_exporter('svg', Part)
class SVGExporter(Exporter):
"""
Export shape to AMF format.
=============== ======================
**Name** ``svg``
**Exports** :class:`Part`
=============== ... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/codec/threejs_json.py | src/cqparts/codec/threejs_json.py | import os
import json
from io import StringIO
import logging
log = logging.getLogger(__name__)
import cadquery
from . import Exporter, register_exporter
from .. import Component, Part, Assembly
@register_exporter('json', Part)
class ThreejsJSONExporter(Exporter):
"""
Export the :class:`Part <cqparts.Part>`... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/codec/stl.py | src/cqparts/codec/stl.py |
import re
import cadquery
from . import Exporter, register_exporter
from .. import Part
@register_exporter('stl', Part)
class STLExporter(Exporter):
"""
Export shape to STL format.
=============== ======================
**Name** ``stl``
**Exports** :class:`Part`
=============== ... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/codec/__init__.py | src/cqparts/codec/__init__.py | from collections import defaultdict
from .. import Component
# ----------------- Exporting -----------------
class Exporter(object):
def __init__(self, obj):
self.obj = obj
def __call__(self):
raise NotImplementedError("%r exporter is not callable" % (type(self)))
exporter_index = defaultdi... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/codec/amf.py | src/cqparts/codec/amf.py |
import re
import cadquery
from . import Exporter, register_exporter
from .. import Part
@register_exporter('amf', Part)
class AMFExporter(Exporter):
"""
Export shape to AMF format.
=============== ======================
**Name** ``amf``
**Exports** :class:`Part`
=============== ... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/codec/step.py | src/cqparts/codec/step.py | import os
import re
import cadquery
from . import Exporter, register_exporter
from . import Importer, register_importer
from .. import Part, Assembly
from ..constraint import Fixed
@register_exporter('step', Part)
class STEPExporter(Exporter):
"""
Export shape to STEP format.
=============== ==========... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/catalogue/catalogue.py | src/cqparts/catalogue/catalogue.py |
class Catalogue(object):
def iter_items(self):
"""
Iterate through every item in the catalogue.
:return: iterator for every item
:rtype: generator
.. note::
Must be overridden by inheriting class
"""
raise NotImplementedError("iter_items not i... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/catalogue/__init__.py | src/cqparts/catalogue/__init__.py | __all__ = [
'Catalogue',
'JSONCatalogue',
]
from .catalogue import Catalogue
from .json import JSONCatalogue
| python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/catalogue/json.py | src/cqparts/catalogue/json.py |
import tinydb
import os
import re
from distutils.version import LooseVersion
from .. import __version__
from .. import Component
from ..errors import SearchError, SearchNoneFoundError, SearchMultipleFoundError
from ..params import ParametricObject
from ..utils import property_buffered
from .catalogue import Catalogu... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/params/parameter.py | src/cqparts/params/parameter.py |
import six
class Parameter(object):
"""
Used to set parameters of a :class:`ParametricObject <parametric_object.ParametricObject>`.
All instances of this class defined in a class' ``__dict__`` will be
valid input to the object's constructor.
**Creating your own Parameter**
To create your ow... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/params/parametric_object.py | src/cqparts/params/parametric_object.py |
from importlib import import_module
from copy import copy
from .parameter import Parameter
from .. import __version__
from ..errors import ParameterError
import logging
log = logging.getLogger(__name__)
class ParametricObject(object):
"""
Parametric objects may be defined like so:
.. doctest::
... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/params/utils.py | src/cqparts/params/utils.py |
from .parameter import Parameter
from .types import NonNullParameter
# ------------ decorator(s) ---------------
def as_parameter(nullable=True, strict=True):
"""
Decorate a container class as a functional :class:`Parameter` class
for a :class:`ParametricObject`.
:param nullable: if set, parameter's ... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/params/__init__.py | src/cqparts/params/__init__.py | __all__ = [
# Core classes
'Parameter',
'ParametricObject',
# Parameter Types
'Boolean',
'ComponentRef',
'Float',
'FloatRange',
'Int',
'IntRange',
'LowerCaseString',
'NonNullParameter',
'PartsList',
'PositiveFloat',
'PositiveInt',
'String',
'UpperCase... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/params/types.py | src/cqparts/params/types.py |
from .parameter import Parameter
from ..errors import ParameterError
# ------------ float types ------------
class Float(Parameter):
"""
Floating point
"""
_doc_type = ':class:`float`'
def type(self, value):
try:
cast_value = float(value)
except ValueError:
... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/display/web.py | src/cqparts/display/web.py |
import os
import sys
import inspect
import tempfile
import shutil
import jinja2
import time
# web content
if sys.version_info[0] >= 3:
# python 3.x
import http.server as SimpleHTTPServer
import socketserver as SocketServer
else:
# python 2.x
import SimpleHTTPServer
import SocketServer
import ... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/display/freecad.py | src/cqparts/display/freecad.py | import cadquery
import os
import logging
log = logging.getLogger(__name__)
from .environment import map_environment, DisplayEnvironment
@map_environment(
name="freecad",
order=10,
condition=lambda: 'MYSCRIPT_DIR' in os.environ,
)
class FreeCADDisplayEnv(DisplayEnvironment):
"""
Display given com... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/display/cqparts_server.py | src/cqparts/display/cqparts_server.py | """ generate the files and notify the cqparts server
look at https://github.com/zignig/cqparts-server
copied and edited from web.py
Copyright 2018 Peter Boin
and Simon Kirkby 2018
"""
import os
import time
import tempfile
import shutil
import logging
import requests
from .environment import map_environment, Disp... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/display/material.py | src/cqparts/display/material.py |
from ..params import NonNullParameter
# Templates (may be used optionally)
COLOR = {
# primary colours
'red': (255, 0, 0),
'green': (0, 255, 0),
'blue': (0, 0, 255),
'cyan': (0, 255, 255),
'magenta': (255, 0, 255),
'yellow': (255, 255, 0),
# woods
'wood_light': (235, 152, 78),
... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/display/__init__.py | src/cqparts/display/__init__.py |
__all__ = [
'render_props',
'RenderProps', 'RenderParam',
# display
'display',
'get_display_environment',
# environment
'environment',
]
import functools
# material
from .material import RenderProps, RenderParam
from .material import render_props
# envionrment
from . import environment... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/display/environment.py | src/cqparts/display/environment.py | __all__ = [
'display_environments',
'map_environment',
'DisplayEnvironment',
]
import logging
log = logging.getLogger(__name__)
display_environments = []
def map_environment(**kwargs):
"""
Decorator to map a DisplayEnvironment for displaying components.
The decorated environment will be cho... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/constraint/constraints.py | src/cqparts/constraint/constraints.py |
from .base import Constraint
from .mate import Mate
from ..utils.geometry import CoordSystem
class Fixed(Constraint):
"""
Sets a component's world coordinates so the given ``mate`` is
positioned and orientated to the given ``world_coords``.
There is only 1 possible solution.
"""
def __init_... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/constraint/mate.py | src/cqparts/constraint/mate.py | from copy import copy
from ..utils.geometry import CoordSystem
from ..utils.misc import property_buffered
class Mate(object):
"""
A mate is a coordinate system relative to a component's origin.
"""
def __init__(self, component, local_coords=None):
"""
:param component: component the ma... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/constraint/solver.py | src/cqparts/constraint/solver.py |
from ..utils.geometry import CoordSystem
from .base import Constraint
from .constraints import Fixed, Coincident
def solver(constraints, coord_sys=None):
"""
Solve constraints. Solutions pair :class:`Constraint <cqparts.constraint.Constraint>`
instances with their suitable :class:`CoordSystem <cqparts.ut... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/constraint/__init__.py | src/cqparts/constraint/__init__.py | __all__ = [
'Mate',
'Constraint',
# Constraints
'Fixed',
'Coincident',
'solver',
]
from .mate import Mate
from . import solver
# Constraints
from .base import Constraint
from .constraints import (
Fixed,
Coincident,
)
| python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/constraint/base.py | src/cqparts/constraint/base.py |
class Constraint(object):
"""
A means to limit the relative position &/or motion of 1 or more components.
Constraints are combined and solved to set world coordinates of the
components within an assembly.
"""
| python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/utils/wrappers.py | src/cqparts/utils/wrappers.py |
def as_part(func):
"""
Converts a function to a :class:`Part <cqparts.Part>` instance.
So the conventionally defined *part*::
import cadquery
from cqparts import Part
from cqparts.params import Float
class Box(Part):
x = Float(1)
y = Float(2)
... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/utils/sphinx.py | src/cqparts/utils/sphinx.py | """
This module is only to be referenced from your project's sphinx autodoc
configuration.
http://www.sphinx-doc.org/en/stable/ext/autodoc.html
"""
from ..params import ParametricObject, Parameter
def _add_lines(lines, new_lines, prepend=False, separator=True):
# Adding / Removing Lines:
# sphinx callback... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/utils/misc.py | src/cqparts/utils/misc.py |
import os
from time import time
from contextlib import contextmanager
import jinja2
class property_buffered(object):
"""
Buffer the result of a method on the class instance, similar to python builtin
``@property``, but the result is kept in memory until it's explicitly deleted.
.. doctest::
... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/utils/__init__.py | src/cqparts/utils/__init__.py | __all__ = [
# env
'get_env_name',
# geometry
'CoordSystem',
# misc
'property_buffered',
'indicate_last',
'working_dir',
'measure_time',
# wrappers
'as_part',
]
from .geometry import CoordSystem
from .misc import property_buffered
from .misc import indicate_last
from .mis... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/utils/geometry.py | src/cqparts/utils/geometry.py | import cadquery
import random
# FIXME: remove freecad dependency from this module...
# right now I'm just trying to get it working.
import FreeCAD
def merge_boundboxes(*bb_list):
"""
Combine bounding boxes to result in a single BoundBox that encloses
all of them.
:param bb_list: List of bound... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/utils/test.py | src/cqparts/utils/test.py | import unittest
import re
import inspect
from .. import Component, Part, Assembly
class ComponentTest(unittest.TestCase):
"""
Generic testcase with utilities for testing
:class:`Part <cqparts.Part>` and :class:`Assembly <cqparts.Assembly>` instances.
For example:
.. doctest::
import cq... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_gearboxes/__init__.py | src/cqparts_gearboxes/__init__.py | """
Copyright 2018 Peter Boin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distrib... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_toys/__init__.py | src/cqparts_toys/__init__.py | """
Copyright 2018 Peter Boin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distrib... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_toys/train/__init__.py | src/cqparts_toys/train/__init__.py | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false | |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_toys/train/track.py | src/cqparts_toys/train/track.py | import cadquery
import cqparts
from cqparts.params import *
from cqparts.utils import property_buffered
from cqparts.display.material import render_props
from cqparts.constraint import Mate
from cqparts.utils import CoordSystem
class _Track(cqparts.Part):
double_sided = Boolean(True, doc="if set, track is cut ... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_misc/__init__.py | src/cqparts_misc/__init__.py | """
Copyright 2018 Peter Boin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distrib... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_misc/basic/primatives.py | src/cqparts_misc/basic/primatives.py | import cadquery
import cqparts
from cqparts.params import *
from cqparts.search import register, common_criteria
from cqparts.constraint import Mate
from cqparts.utils import CoordSystem
# basic.primatives registration utility
module_criteria = {
'lib': 'basic',
'type': 'primative',
'module': __name__,
}... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_misc/basic/indicators.py | src/cqparts_misc/basic/indicators.py | import cadquery
import cqparts
from cqparts.params import *
from cqparts.constraint import Fixed, Mate
from cqparts.search import register, common_criteria
from cqparts.utils.wrappers import as_part
from cqparts.display.material import TEMPLATE
# basic.primatives registration utility
module_criteria = {
'lib': '... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_misc/basic/__init__.py | src/cqparts_misc/basic/__init__.py | __all__ = [
'indicators',
'primatives',
]
from . import indicators
from . import primatives
| python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_motors/stepper.py | src/cqparts_motors/stepper.py |
""" cqparts motors
2018 Simon Kirkby obeygiantrobot@gmail.com
stepper motor generic
"""
# TODO
# even 4 fasteners so it auto mounts to whatever it is parented to.
import cadquery as cq
import cqparts
from cqparts.params import PositiveFloat
from cqparts.constraint import Fixed, Coincident
from cqparts.constraint ... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_motors/shaft.py | src/cqparts_motors/shaft.py | """
cp parts
base shaft collection
# 2018 Simon Kirkby obeygiantrobot@gmail.com
"""
# TODO
# need tip , base and offset mate points
# maybe shaft needs to go into it's own module
#
# there are lots of types of shafts and extras
# need a clean way to build shafts
import cadquery as cq
import cqparts
from cqparts.para... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_motors/dc.py | src/cqparts_motors/dc.py | """
DC motor cqparts model
2018 Simon Kirkby obeygiantrobot@gmail.com
"""
import math
import cadquery as cq
import cqparts
from cqparts.params import PositiveFloat, String
from cqparts.display import render_props
from cqparts.constraint import Fixed, Coincident
from cqparts.constraint import Mate
from cqparts.utils.g... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_motors/motor.py | src/cqparts_motors/motor.py | # base motor class
#
# 2018 Simon Kirkby obeygiantrobot@gmail.com
import cqparts
# base motor class
# TODO lift all motor things up to here
class Motor(cqparts.Assembly):
def mount_points(self):
raise NotImplementedError("mount_points function not implemented")
def get_shaft(self):
raise N... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_motors/__init__.py | src/cqparts_motors/__init__.py | """
Copyright 2018 Peter Boin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distrib... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_motors/catalogue/scripts/stepper-nema.py | src/cqparts_motors/catalogue/scripts/stepper-nema.py | #!/usr/bin/env python
# Catalogue Usage example:
# >>> from cqparts.catalogue import JSONCatalogue
# >>> import cqparts_motors
# >>> filename = os.path.join(
# ... os.path.dirname(cqparts_motors.__file__),
# ... 'catalogue', 'stepper-nema.json',
# ... )
# >>> catalogue = JSONCatalogue(filename)
#... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_motors/catalogue/scripts/dc-hobby.py | src/cqparts_motors/catalogue/scripts/dc-hobby.py | #!/usr/bin/env python
# Catalogue Usage example:
# >>> from cqparts.catalogue import JSONCatalogue
# >>> import cqparts_motors
# >>> filename = os.path.join(
# ... os.path.dirname(cqparts_motors.__file__),
# ... 'catalogue', 'dcmotor.json',
# ... )
# >>> catalogue = JSONCatalogue(filename)
# >>... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_springs/__init__.py | src/cqparts_springs/__init__.py | """
Copyright 2018 Peter Boin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distrib... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
cqparts/cqparts | https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts_template/search.py | src/cqparts_template/search.py |
from cqparts.search import (
find as _find,
search as _search,
register as _register,
)
from cqparts.search import common_criteria
module_criteria = {
'module': __name__,
}
register = common_criteria(**module_criteria)(_register)
search = common_criteria(**module_criteria)(_search)
find = common_crit... | python | Apache-2.0 | 018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53 | 2026-01-05T07:14:41.025281Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.