Esempio n. 1
0
void BoardGerberExport::exportDrillsPth() const {
  FilePath          fp = getOutputFilePath(mSettings->getSuffixDrillsPth());
  ExcellonGenerator gen;
  drawPthDrills(gen);
  gen.generate();
  gen.saveToFile(fp);
  mWrittenFiles.append(fp);
}
Esempio n. 2
0
void BoardGerberExport::exportLayerTopSilkscreen() const {
  QStringList layers = mSettings->getSilkscreenLayersTop();
  if (layers.count() >
      0) {  // don't create silkscreen file if no layers selected
    FilePath        fp = getOutputFilePath(mSettings->getSuffixSilkscreenTop());
    GerberGenerator gen(
        mProject.getMetadata().getName() % " - " % mBoard.getName(),
        mBoard.getUuid(), mProject.getMetadata().getVersion());
    foreach (const QString& layer, layers) { drawLayer(gen, layer); }
Esempio n. 3
0
void BoardGerberExport::exportLayerBottomSolderMask() const {
  FilePath        fp = getOutputFilePath(mSettings->getSuffixSolderMaskBot());
  GerberGenerator gen(
      mProject.getMetadata().getName() % " - " % mBoard.getName(),
      mBoard.getUuid(), mProject.getMetadata().getVersion());
  drawLayer(gen, GraphicsLayer::sBotStopMask);
  gen.generate();
  gen.saveToFile(fp);
  mWrittenFiles.append(fp);
}
Esempio n. 4
0
void BoardGerberExport::exportLayerInnerCopper() const {
  for (int i = 1; i <= mBoard.getLayerStack().getInnerLayerCount(); ++i) {
    mCurrentInnerCopperLayer = i;  // used for attribute provider
    FilePath        fp = getOutputFilePath(mSettings->getSuffixCopperInner());
    GerberGenerator gen(
        mProject.getMetadata().getName() % " - " % mBoard.getName(),
        mBoard.getUuid(), mProject.getMetadata().getVersion());
    drawLayer(gen, GraphicsLayer::getInnerLayerName(i));
    gen.generate();
    gen.saveToFile(fp);
    mWrittenFiles.append(fp);
  }
  mCurrentInnerCopperLayer = 0;
}
Esempio n. 5
0
void BoardGerberExport::exportDrillsNpth() const {
  FilePath          fp = getOutputFilePath(mSettings->getSuffixDrillsNpth());
  ExcellonGenerator gen;
  int               count = drawNpthDrills(gen);
  if (count > 0) {
    // Some PCB manufacturers don't like to have separate drill files for PTH
    // and NPTH. As many boards don't have non-plated holes anyway, we create
    // this file only if it's really needed. Maybe this avoids unnecessary
    // issues with manufacturers...
    gen.generate();
    gen.saveToFile(fp);
    mWrittenFiles.append(fp);
  }
}
Esempio n. 6
0
/*!
  \internal

  Imports the file specified by \a filePath. File destination is acquired
  automatically based on output path.
  */
bool SpdrImportPrivate::importFile(const QString &filePath) const
{
    QString outputPath(getOutputFilePath(filePath));
    outputPath = substituteStarsInPath(outputPath);
    return performFileOperation(filePath, outputPath);
}
void MediaConvert::convert(const bool enableFileThreading, const int numOfThreads, bool valid, double duration){
	if(valid){
		std::unique_lock<std::mutex> uniqueLock(mutex);
		while(this->getOutputFilePath().exist() && !enableOverwrite && !isAbort){
			convertState = OVERWRITE;
			condition.wait(uniqueLock);
		}
		if(isAbort){
			convertState = ABORT;
			return;
		}

		convertState = PROCESSING;

		generator.setThreading(enableFileThreading, numOfThreads);

		std::list<std::string> arguments = generator.generate();
		arguments.push_front("-y");
		arguments.push_front(mediaPath.getPath());
		arguments.push_front("-i");
		arguments.push_back(getOutputFilePath().getPath());
		auto extConverter = UserPreferences::getInstance()->getExtConverterPath();
		std::stringstream textCommand;
		textCommand<<"command:"<<std::endl;
		textCommand<<extConverter.getPath();
		for(auto x : arguments){
			textCommand<<" "<<x;
		}
		textCommand<<std::endl<<std::endl;
		errorOutputBuffer << textCommand.str();
		Converter::ConvertParser parser(duration);
		process = new ProcessExecutor::Process(extConverter.getPath(), arguments);
		process->waitForProcessBegin();
		uniqueLock.unlock();
		auto& stderr = process->getStdErr();
		std::string line;
		while(stderr >> line){
			double tmpFraction = 0;
			int tmpTime = 0;
			bool processOk = parser.processLine(line, tmpFraction, tmpTime);
			if(processOk){
				fraction = tmpFraction;
				if(tmpTime > 0){
					remainingTime = tmpTime;
				}
			}else{
				errorOutputBuffer << line << std::endl;
			}
		}
		int res = process->waitForProcessEnd();
		if(res != 0){
			convertState = FAIL;
		}else{
			convertState = FINISH;
		}
		fraction = 1;
		remainingTime = 0;
		uniqueLock.lock();
		delete process;
		process = NULL;
		uniqueLock.unlock();
	}else{