Exemple #1
0
def tile_jobs(Jobs):
  """Take a list of raw Job objects and find best tiling by calling tile_search"""

  # We must take the raw jobs and construct a list of 4-tuples (Xdim,Ydim,job,rjob).
  # This means we must construct a rotated job for each entry. We first sort all
  # jobs from largest to smallest. This should give us the best tilings first so
  # we can interrupt the tiling process and get a decent layout.
  L = []
  #sortJobs = schwartz.schwartz(Jobs, jobs.Job.jobarea)
  sortJobs = schwartz.schwartz(Jobs, jobs.Job.maxdimension)
  sortJobs.reverse()

  for job in sortJobs:
    Xdim = job.width_in()
    Ydim = job.height_in()
    rjob = jobs.rotateJob(job, 90)  ##NOTE: This will only try 90 degree rotations though 180 & 270 are available

    for count in range(job.Repeat):
      L.append( (Xdim,Ydim,job,rjob) )

  PX,PY = config.Config['panelwidth'],config.Config['panelheight']
  if config.AutoSearchType==RANDOM_SEARCH:
    tile = tilesearch2.tile_search2(L, PX, PY)
  else:
    tile = tilesearch1.tile_search1(L, PX, PY)

  if not tile:
    # add metric support (1/1000 mm vs. 1/100,000 inch)
    if config.Config['measurementunits'] == 'inch':
      raise RuntimeError, 'Panel size %.2f"x%.2f" is too small to hold jobs' % (PX,PY)
    else:
      raise RuntimeError, 'Panel size %.2fmmx%.2fmm is too small to hold jobs' % (PX,PY)

  return tile
Exemple #2
0
def tile_jobs(Jobs):
  """Take a list of raw Job objects and find best tiling by calling tile_search"""

  # We must take the raw jobs and construct a list of 4-tuples (Xdim,Ydim,job,rjob).
  # This means we must construct a rotated job for each entry. We first sort all
  # jobs from largest to smallest. This should give us the best tilings first so
  # we can interrupt the tiling process and get a decent layout.
  L = []
  #sortJobs = schwartz.schwartz(Jobs, jobs.Job.jobarea)
  sortJobs = schwartz.schwartz(Jobs, jobs.Job.maxdimension)
  sortJobs.reverse()

  for job in sortJobs:
    Xdim = job.width_in()
    Ydim = job.height_in()
    rjob = jobs.rotateJob(job, 90)  ##NOTE: This will only try 90 degree rotations though 180 & 270 are available

    for count in range(job.Repeat):
      L.append( (Xdim,Ydim,job,rjob) )

  PX,PY = config.Config['panelwidth'],config.Config['panelheight']
  if config.AutoSearchType==RANDOM_SEARCH:
    tile = tilesearch2.tile_search2(L, PX, PY)
  else:
    tile = tilesearch1.tile_search1(L, PX, PY)

  if not tile:
    # add metric support (1/1000 mm vs. 1/100,000 inch)
    if config.Config['measurementunits'] == 'inch':
      raise RuntimeError, 'Panel size %.2f"x%.2f" is too small to hold jobs' % (PX,PY)
    else:
      raise RuntimeError, 'Panel size %.2fmmx%.2fmm is too small to hold jobs' % (PX,PY)

  return tile