コード例 #1
0
ファイル: profile_pycam.py プロジェクト: zancas/pycam
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)
コード例 #2
0
 def _get_bounds_instance_from_dict(self, indict):
     """ get Bounds instances for each bounds definition
     @value model: the model that should be used for relative margins
     @type model: pycam.Geometry.Model.Model or callable
     @returns: list of Bounds instances
     @rtype: list(Bounds)
     """
     low_bounds = (indict["x_low"], indict["y_low"], indict["z_low"])
     high_bounds = (indict["x_high"], indict["y_high"], indict["z_high"])
     if indict["type"] == "relative_margin":
         bounds_type = Bounds.TYPE_RELATIVE_MARGIN
     elif indict["type"] == "fixed_margin":
         bounds_type = Bounds.TYPE_FIXED_MARGIN
     else:
         bounds_type = Bounds.TYPE_CUSTOM
     new_bound = Bounds(bounds_type, low_bounds, high_bounds)
     new_bound.set_name(indict["name"])
     return new_bound
コード例 #3
0
ファイル: Settings.py プロジェクト: I--Fox--I/pycam
 def _get_bounds_instance_from_dict(self, indict):
     """ get Bounds instances for each bounds definition
     @value model: the model that should be used for relative margins
     @type model: pycam.Geometry.Model.Model or callable
     @returns: list of Bounds instances
     @rtype: list(Bounds)
     """
     low_bounds = (indict["x_low"], indict["y_low"], indict["z_low"])
     high_bounds = (indict["x_high"], indict["y_high"], indict["z_high"])
     if indict["type"] == "relative_margin":
         bounds_type = Bounds.TYPE_RELATIVE_MARGIN
     elif indict["type"] == "fixed_margin":
         bounds_type = Bounds.TYPE_FIXED_MARGIN
     else:
         bounds_type = Bounds.TYPE_CUSTOM
     new_bound = Bounds(bounds_type, low_bounds, high_bounds)
     new_bound.set_name(indict["name"])
     return new_bound
コード例 #4
0
ファイル: profile_pycam.py プロジェクト: I--Fox--I/pycam
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,
                    (model.minx-5, model.miny-5, model.minz),
                    (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)
    moves = path_generator.GenerateToolPath(tool, [model], motion_grid,
                                            minz=low[2], maxz=high[2],
                                            draw_callback=progress_bar.update)
コード例 #5
0
ファイル: pycam.py プロジェクト: petervanderwalt/pycam-cloud
 if inputfile is None:
     model = get_default_model()
     # the "get_default_model" function returns a string or a model
     if isinstance(model, basestring):
         model = load_model_file(model,
                                 program_locations=program_locations,
                                 unit=opts.unit_size)
 else:
     model = load_model_file(inputfile,
                             program_locations=program_locations,
                             unit=opts.unit_size)
 if model is None:
     # something went wrong - we quit
     return EXIT_CODES["load_model_failed"]
 # calculate the processing boundary
 bounds = Bounds()
 bounds.set_reference(model.get_bounds())
 # set the bounds type and let the default bounding box match the model
 if opts.bounds_type == "relative-margin":
     bounds.set_type(Bounds.TYPE_RELATIVE_MARGIN)
     bounds_default_low = (0, 0, 0)
     bounds_default_high = (0, 0, 0)
 elif opts.bounds_type == "fixed-margin":
     bounds.set_type(Bounds.TYPE_FIXED_MARGIN)
     bounds_default_low = (0, 0, 0)
     bounds_default_high = (0, 0, 0)
 else:
     # custom boundary setting
     bounds.set_type(Bounds.TYPE_CUSTOM)
     bounds_default_low = (model.minx, model.miny, model.minz)
     bounds_default_high = (model.maxx, model.maxy, model.maxz)
コード例 #6
0
ファイル: Model.py プロジェクト: zancas/pycam
 def get_bounds(self):
     return Bounds(
         Bounds.TYPE_CUSTOM,
         Box3D(Point3D(self.minx, self.miny, self.minz),
               Point3D(self.maxx, self.maxy, self.maxz)))
コード例 #7
0
 def get_bounds(self):
     low = (self.bounds["minx"], self.bounds["miny"], self.bounds["minz"])
     high = (self.bounds["maxx"], self.bounds["maxy"], self.bounds["maxz"])
     return Bounds(Bounds.TYPE_CUSTOM, low, high)
コード例 #8
0
 def get_bounds(self):
     low = (self.bounds["minx"], self.bounds["miny"], self.bounds["minz"])
     high = (self.bounds["maxx"], self.bounds["maxy"], self.bounds["maxz"])
     return Bounds(Bounds.TYPE_CUSTOM, Box3D(Point3D(low), Point3D(high)))
コード例 #9
0
ファイル: Model.py プロジェクト: weeberp/MakerDroid
 def get_bounds(self):
     return Bounds(Bounds.TYPE_CUSTOM, (self.minx, self.miny, self.minz),
                   (self.maxx, self.maxy, self.maxz))
コード例 #10
0
ファイル: pycampy.py プロジェクト: chriskyfung/MakerDroid
 # load the model
 if inputfile is None:
     model = get_default_model()
     # the "get_default_model" function returns a string or a model
     if isinstance(model, basestring):
         model = load_model_file(model,
                 program_locations=program_locations,
                 unit=opts.unit_size)
 else:
     model = load_model_file(inputfile,
             program_locations=program_locations, unit=opts.unit_size)
 if model is None:
     # something went wrong - we quit
     return EXIT_CODES["load_model_failed"]
 # calculate the processing boundary
 bounds = Bounds()
 bounds.set_reference(model.get_bounds())
 # set the bounds type and let the default bounding box match the model
 if opts.bounds_type == "relative-margin":
     bounds.set_type(Bounds.TYPE_RELATIVE_MARGIN)
     bounds_default_low = (0, 0, 0)
     bounds_default_high = (0, 0, 0)
 elif opts.bounds_type == "fixed-margin":
     bounds.set_type(Bounds.TYPE_FIXED_MARGIN)
     bounds_default_low = (0, 0, 0)
     bounds_default_high = (0, 0, 0)
 else:
     # custom boundary setting
     bounds.set_type(Bounds.TYPE_CUSTOM)
     bounds_default_low = (model.minx, model.miny, model.minz)
     bounds_default_high = (model.maxx, model.maxy, model.maxz)