Esempio n. 1
0
 def get_shape(self, engine="ODE"):
     if engine == "ODE":
         from pycam.Cutters.CylindricalCutter import CylindricalCutter
         # TODO: use an appromixated trimesh instead (ODE does not support
         # toroidal shapes)
         # for now: use the simple cylinder shape - this should be ok
         cylinder = CylindricalCutter(self.radius, location=self.location,
                 height=self.height)
         cylinder.set_required_distance(self.get_required_distance())
         self.shape[engine] = cylinder.get_shape(engine)
         return self.shape[engine]
Esempio n. 2
0
 def get_shape(self, engine="ODE"):
     if engine == "ODE":
         from pycam.Cutters.CylindricalCutter import CylindricalCutter
         # TODO: use an appromixated trimesh instead (ODE does not support
         # toroidal shapes)
         # for now: use the simple cylinder shape - this should be ok
         cylinder = CylindricalCutter(self.radius, location=self.location,
                 height=self.height)
         cylinder.set_required_distance(self.get_required_distance())
         self.shape[engine] = cylinder.get_shape(engine)
         return self.shape[engine]
Esempio n. 3
0
def get_tool_from_settings(tool_settings, height=None):
    """ get the tool specified by the relevant settings

    The settings must include:
      - "shape": one of "SphericalCutter", "CylindricalCutter" and
        "ToroidalCutter"
      - "radius": the tool radius
    The following settings are optional or shape specific:
      - "torus_radius": necessary for ToroidalCutter

    @type tool_settings: dict
    @value tool_settings: contains the attributes of the tool
    @type height: float
    @value height: the height of the tool
    @rtype: BaseCutter | basestring
    @return: a tool object or an error string
    """
    cuttername = tool_settings["shape"]
    radius = tool_settings["tool_radius"]
    if cuttername == "SphericalCutter":
        return SphericalCutter(radius, height=height)
    elif cuttername == "CylindricalCutter":
        return CylindricalCutter(radius, height=height)
    elif cuttername == "ToroidalCutter":
        toroid = tool_settings["torus_radius"]
        return ToroidalCutter(radius, toroid, height=height)
    else:
        return "Invalid cutter shape: '%s' is not known" % str(cuttername)
Esempio n. 4
0
def run_dropcutter():
    """ Run DropCutter on standard PyCAM sample plaque """
    progress_bar = ConsoleProgressBar(sys.stdout)

    overlap = .6
    layer_distance = 1
    tool = CylindricalCutter(10)
    path_generator = DropCutter(PathAccumulator())
    bounds = Bounds(Bounds.TYPE_CUSTOM, Box3D(Point3D(model.minx-5, model.miny-5, model.minz),
                                              Point3D(model.maxx+5, model.maxy+5, model.maxz)))

    low, high = bounds.get_absolute_limits()
    line_distance = 2 * tool.radius * (1.0 - overlap)

    motion_grid = get_fixed_grid((low, high), layer_distance,
                                 line_distance, tool.radius / 4.0)
    path_generator.GenerateToolPath(tool, [model], motion_grid, minz=low[2], maxz=high[2],
                                    draw_callback=progress_bar.update)
Esempio n. 5
0
You should have received a copy of the GNU General Public License
along with PyCAM.  If not, see <http://www.gnu.org/licenses/>.
"""

from pycam.Geometry import Line, Path, Point, Triangle
from pycam.Cutters.CylindricalCutter import CylindricalCutter

from pycam.Gui.Visualization import ShowTestScene


if __name__ == "__main__":

    dir = Point(0, 0, -1)
#   c = CylindricalCutter(1, Point(0, 0, 6))
    c = CylindricalCutter(1, Point(2, 0, 6))
#   c = CylindricalCutter(1, Point(-2.2, 0.2, 6))
#   c = CylindricalCutter(1, Point(-1.7, -0.2, 6))
    print("c=", c)
#   t = Triangle(Point(-3, 0, 2), Point(2, 2, 3), Point(2, -2, 4))
#   t = Triangle(Point(-2, 0, 2), Point(2, -1, 4), Point(2, 1, 3))
#   t = Triangle(Point(2, 0, 4), Point(2, -1, 2), Point(2, 1, 2))
#   t = Triangle(Point(2, 0, 4), Point(2, 1, 2), Point(2, -1, 2))
#   t = Triangle(Point(-3, 0, 4), Point(2, 2, 2), Point(2, -2, 2))
    t = Triangle(Point(-3, 0, 2.5), Point(3, 0, 2.5), Point(0, 1, 1.5))
    print("t=", t)

    if False:
        print("plane:")
        (cl_p, ccp_p, cp_p, d_p) = c.intersect_circle_plane(dir, t)
        print("ccp=", ccp_p)
Esempio n. 6
0
from pycam.Cutters.SphericalCutter import SphericalCutter
from pycam.Cutters.CylindricalCutter import CylindricalCutter
from pycam.Cutters.ToroidalCutter import ToroidalCutter

from pycam.Gui.Visualization import ShowTestScene

from pycam.Importers import STLImporter

from pycam.PathGenerators.PushCutter import PushCutter
from pycam.PathProcessors import SimpleCutter

if __name__ == "__main__":

    for c in [
            SphericalCutter(0.1, Point(0, 0, 7)),
            CylindricalCutter(1, Point(0, 0, 7)),
            ToroidalCutter(1, 0.25, Point(0, 0, 7))
    ]:
        print("c=", c)

        #       model = TestModel()
        #       model = STLImporter.ImportModel("Samples/STL/Box0.stl")
        #       model = STLImporter.ImportModel("Samples/STL/Box1.stl")
        model = STLImporter.ImportModel("Samples/STL/Box0+1.stl")
        #       model = Model()
        #       model.append(Triangle(Point(0, 0, 0), Point(0, 5, 4), Point(0, -5, 4)))
        #       model.append(Triangle(Point(2, 0, 0), Point(2, -5, 4), Point(2, 5, 4)))

        if True:
            lines = 20
            layers = 4
Esempio n. 7
0
 def _drop(self, radius, triangle):
     return CylindricalCutter(radius, location=(0, 0, 0)).drop(triangle)