Skip to content

RDxfServices

Class in Core Module
Header: #include <src/core/RDxfServices.h>

DXF support tools, mainly for QCAD 2 DXF imports.

Scriptable: This class is available in script environments.

Copyable: Objects are cleaned up automatically by the garbage collector of the script engine.

enum Type { Unknown, String, Int, Float, Vector }
RDxfServices()
~RDxfServices()
QString collectVersion2Info(const QString &fileName)
QCAD 2 stores the font name in field ‘text style name’, DXF code 7 which is not supported by Teigha.
void detectVersion2Format(const QString &fileName)
void fixBlockName(QString &blockName)
void fixDimensionLabel(QString &text, QString &uTol, QString &lTol) const
QString fixFontName(const QString &fontName) const
Makes DXF/DWG font names QCAD compatible by removing .shx and fixing the name if appropriate.
void fixLayerName(QString &layerName)
void fixVersion2HatchData(QString &patternName, double &angle, double &scale, bool solid) const
void fixVersion2String(QString &str) const
QTextCodec * getCodec() const
int getMajorVersion() const
int getMinorVersion() const
int getPatchVersion() const
bool getVersion2Compatibility() const
QString getVersion2DimensionLabel(const QString &handle) const
QString getVersion2Font(const QString &handle) const
QString getVersion2LayerName(const QString &layerName) const
double getVersion2PatternAngle(double angle, const QString &patternName) const
QString getVersion2PatternName(const QString &patternName) const
double getVersion2PatternScale(double scale, const QString &patternName) const
bool getVersion3_1Compatibility() const
QString getVersionBlockName(const QString &blockName) const
bool hasDIMAZIN() const
bool hasDIMZIN() const
bool hasInvalidEllipse() const
void reset()
void setCodec(QTextCodec *codec)
static RColor attributesToColor(int color, int color24, const double dxfColors[][3], bool forLayer=false)
static void autoFixLinetypePattern(RLinetypePattern &pattern)
static int colorToNumber(const RColor &col, const double dxfColors[][3])
Converts a color into a color number in the DXF palette.
static int colorToNumber24(const RColor &col)
static QString decodeMifString(const QString &input)
static QString escapeUnicode(const QString &str)
static int getAci(const RColor &col)
static int getCodeForVariable(RS::KnownVariable v)
static RColor getColor(unsigned int index)
static RDxfServicesProxy * getDxfServicesProxy()
static int getFileQCADVersion(const RDocument &doc)
static QString getSafeBlockName(QString &blockName)
static RDxfServices::Type getTypeForVariable(RS::KnownVariable v)
static bool hasProxy()
static void initAci()
static bool isVariable2D(RS::KnownVariable v)
Checks if the given variable is two-dimensional (e.g.
static RColor numberToColor(int num, const double dxfColors[][3], bool comp=false, bool forLayer=false)
Converts a color index (num) into a RColor object.
static RColor numberToColor24(int num)
static RLineweight::Lineweight numberToWeight(int num)
Converts a line width number (e.g.
static QString parseUnicode(const QString &str)
static void setDxfServicesProxy(RDxfServicesProxy *p)
static RS::KnownVariable stringToVariable(const QString &s)
static QString variableToString(RS::KnownVariable v)
static int widthToNumber(RLineweight::Lineweight w)
Converts a RLineweight::Lineweight into an int width for use in DXF files.
QTextCodec * codec
int dxflibMajorVersion
int dxflibMinorVersion
int dxflibPatchVersion
QMap< QString, QString > version2BlockMapping
QMap< QString, QString > version2DimensionLabels
bool version2GotDIMAZIN
bool version2GotDIMZIN
bool version2GotInvalidEllipse
QMap< QString, QString > version2LayerMapping
QMap< QString, QString > version2TextFonts
static QMap< unsigned int, QRgb > aci
static RDxfServicesProxy * dxfServicesProxy
static QMap< QRgb, unsigned int > revAci

enum Type
Value Description
Unknown
String
Int
Float
Vector

RDxfServices::RDxfServices()

RDxfServices::~RDxfServices()

QString RDxfServices::collectVersion2Info(const QString &fileName)

QCAD 2 stores the font name in field ‘text style name’, DXF code 7 which is not supported by Teigha.

This function collects all font names of MTEXT entities for use by RDwgMTextImporter.

void RDxfServices::detectVersion2Format(const QString &fileName)

void RDxfServices::fixBlockName(QString &blockName)

void RDxfServices::fixDimensionLabel(QString &text, QString &uTol, QString &lTol) const

const

QString RDxfServices::fixFontName(const QString &fontName) const

const

Makes DXF/DWG font names QCAD compatible by removing .shx and fixing the name if appropriate.

void RDxfServices::fixLayerName(QString &layerName)

void RDxfServices::fixVersion2HatchData(QString &patternName, double &angle, double &scale, bool solid) const

const

void RDxfServices::fixVersion2String(QString &str) const

const

QTextCodec * RDxfServices::getCodec() const

inline const

int RDxfServices::getMajorVersion() const

inline const

int RDxfServices::getMinorVersion() const

inline const

int RDxfServices::getPatchVersion() const

inline const

bool RDxfServices::getVersion2Compatibility() const

inline const

QString RDxfServices::getVersion2DimensionLabel(const QString &handle) const

const

QString RDxfServices::getVersion2Font(const QString &handle) const

const

QString RDxfServices::getVersion2LayerName(const QString &layerName) const

const

double RDxfServices::getVersion2PatternAngle(double angle, const QString &patternName) const

const

QString RDxfServices::getVersion2PatternName(const QString &patternName) const

const

double RDxfServices::getVersion2PatternScale(double scale, const QString &patternName) const

const

Parameters:

  • scale: Old QCAD 2 pattern scale.
  • patternName: Old QCAD 2 pattern name.

bool RDxfServices::getVersion3_1Compatibility() const

inline const

QString RDxfServices::getVersionBlockName(const QString &blockName) const

const

bool RDxfServices::hasDIMAZIN() const

inline const

bool RDxfServices::hasDIMZIN() const

inline const

bool RDxfServices::hasInvalidEllipse() const

inline const

void RDxfServices::reset()

void RDxfServices::setCodec(QTextCodec *codec)

inline

static RColor RDxfServices::attributesToColor(int color, int color24, const double dxfColors[][3], bool forLayer=false)

static

Non-Scriptable: This function is not available in script environments.

Returns: Pen with the same attributes as ‘attributes’.

static void RDxfServices::autoFixLinetypePattern(RLinetypePattern &pattern)

static

static int RDxfServices::colorToNumber(const RColor &col, const double dxfColors[][3])

static

Converts a color into a color number in the DXF palette.

Non-Scriptable: This function is not available in script environments.

The color that fits best is chosen.

static int RDxfServices::colorToNumber24(const RColor &col)

static

Returns: 24 bit color as DXF prepared int.

static QString RDxfServices::decodeMifString(const QString &input)

static

static QString RDxfServices::escapeUnicode(const QString &str)

static

static int RDxfServices::getAci(const RColor &col)

static

static int RDxfServices::getCodeForVariable(RS::KnownVariable v)

static

static RColor RDxfServices::getColor(unsigned int index)

static

static RDxfServicesProxy * RDxfServices::getDxfServicesProxy()

static inline

Non-Scriptable: This function is not available in script environments.

static int RDxfServices::getFileQCADVersion(const RDocument &doc)

static

static QString RDxfServices::getSafeBlockName(QString &blockName)

static

static RDxfServices::Type RDxfServices::getTypeForVariable(RS::KnownVariable v)

static

static bool RDxfServices::hasProxy()

static inline

static void RDxfServices::initAci()

static

static bool RDxfServices::isVariable2D(RS::KnownVariable v)

static

Checks if the given variable is two-dimensional (e.g.

$LIMMIN).

static RColor RDxfServices::numberToColor(int num, const double dxfColors[][3], bool comp=false, bool forLayer=false)

static

Converts a color index (num) into a RColor object.

Non-Scriptable: This function is not available in script environments.

Please refer to the dxflib documentation for details.

Parameters:

  • num: Color number.
  • comp: Compatibility with older QCad versions (1.5.3 and older)

static RColor RDxfServices::numberToColor24(int num)

static

Returns: color object from DXF coded integer 24 bit color number.

static RLineweight::Lineweight RDxfServices::numberToWeight(int num)

static

Converts a line width number (e.g.

  1. into a RS2::LineWidth.

static QString RDxfServices::parseUnicode(const QString &str)

static

static void RDxfServices::setDxfServicesProxy(RDxfServicesProxy *p)

static inline

Non-Scriptable: This function is not available in script environments.

static RS::KnownVariable RDxfServices::stringToVariable(const QString &s)

static

static QString RDxfServices::variableToString(RS::KnownVariable v)

static

static int RDxfServices::widthToNumber(RLineweight::Lineweight w)

static

Converts a RLineweight::Lineweight into an int width for use in DXF files.

QTextCodec* RDxfServices::codec

private

int RDxfServices::dxflibMajorVersion

private

int RDxfServices::dxflibMinorVersion

private

int RDxfServices::dxflibPatchVersion

private

QMap<QString, QString> RDxfServices::version2BlockMapping

private

QMap<QString, QString> RDxfServices::version2DimensionLabels

private

bool RDxfServices::version2GotDIMAZIN

private

bool RDxfServices::version2GotDIMZIN

private

bool RDxfServices::version2GotInvalidEllipse

private

QMap<QString, QString> RDxfServices::version2LayerMapping

private

QMap<QString, QString> RDxfServices::version2TextFonts

private

static QMap< unsigned int, QRgb > RDxfServices::aci

static private

All rights reserved.

This file is part of the QCAD project.

QCAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

QCAD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with QCAD.

static RDxfServicesProxy * RDxfServices::dxfServicesProxy = NULL

static private

static QMap< QRgb, unsigned int > RDxfServices::revAci

static private