double RExporter::getLineTypePatternScale(const RLinetypePattern& p) const { if (document==NULL) { return 1.0; } double factor = 1.0; // document wide linetype scale: double docLinetypeScale = document->getKnownVariable(RS::LTSCALE).toDouble(); if (docLinetypeScale>1e-6) { // LTSCALE might be zero: factor *= docLinetypeScale; } //qDebug() << "factor (doc): " << factor; // drawing unit scale: if (p.isMetric()) { // metric line type patterns are defined in mm: factor *= RUnit::convert(1.0, RS::Millimeter, document->getUnit()); } else { // imperial line type patterns are defined in inches: factor *= RUnit::convert(1.0, RS::Inch, document->getUnit()); } //qDebug() << "factor (unit): " << factor; // entity line type scale: const REntity* entity = getEntity(); if (entity!=NULL) { double entityLinetypeScale = entity->getLinetypeScale(); if (!RMath::fuzzyCompare(entityLinetypeScale, 1.0)) { if (entityLinetypeScale>1e-6) { factor *= entityLinetypeScale; } } } //qDebug() << "factor (entity): " << factor; // optional: automatic scaling by line weight: if (RSettings::getAutoScaleLinetypePatterns()) { if (currentPen.widthF()<1e-6) { // line pattern factor for lines of width 0: int zww = RSettings::getZeroWeightWeight()/100.0; if (zww<=0) { zww = 1.0; } //factor *= RUnit::convert(zww/100.0, RS::Millimeter, document->getUnit()); factor *= zww; } else { //qDebug() << "currentPen.widthF(): " << currentPen.widthF(); //qDebug() << "currentPen.widthF() mm: " << RUnit::convert(currentPen.widthF(), document->getUnit(), RS::Millimeter); factor *= RUnit::convert(currentPen.widthF(), document->getUnit(), RS::Millimeter); } } //qDebug() << "factor: " << factor; return factor; }