RDxfServices
Class in Core Module
Header: #include <src/core/RDxfServices.h>
Description
Section titled “Description”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.
Public Types
Section titled “Public Types”| enum | Type { Unknown, String, Int, Float, Vector } |
Public Functions
Section titled “Public Functions”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) constMakes 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 Public Functions
Section titled “Static Public Functions”| 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. |
Private Attributes
Section titled “Private Attributes”| 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 Private Attributes
Section titled “Static Private Attributes”| static QMap< unsigned int, QRgb > | aci |
| static RDxfServicesProxy * | dxfServicesProxy |
| static QMap< QRgb, unsigned int > | revAci |
Member Documentation
Section titled “Member Documentation”enum Type| Value | Description |
|---|---|
Unknown |
|
String |
|
Int |
|
Float |
|
Vector |
RDxfServices
Section titled “RDxfServices”RDxfServices::RDxfServices()~RDxfServices
Section titled “~RDxfServices”RDxfServices::~RDxfServices()collectVersion2Info
Section titled “collectVersion2Info”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.
detectVersion2Format
Section titled “detectVersion2Format”void RDxfServices::detectVersion2Format(const QString &fileName)fixBlockName
Section titled “fixBlockName”void RDxfServices::fixBlockName(QString &blockName)fixDimensionLabel
Section titled “fixDimensionLabel”void RDxfServices::fixDimensionLabel(QString &text, QString &uTol, QString &lTol) constconst
fixFontName
Section titled “fixFontName”QString RDxfServices::fixFontName(const QString &fontName) constconst
Makes DXF/DWG font names QCAD compatible by removing .shx and fixing the name if appropriate.
fixLayerName
Section titled “fixLayerName”void RDxfServices::fixLayerName(QString &layerName)fixVersion2HatchData
Section titled “fixVersion2HatchData”void RDxfServices::fixVersion2HatchData(QString &patternName, double &angle, double &scale, bool solid) constconst
fixVersion2String
Section titled “fixVersion2String”void RDxfServices::fixVersion2String(QString &str) constconst
getCodec
Section titled “getCodec”QTextCodec * RDxfServices::getCodec() constinline const
getMajorVersion
Section titled “getMajorVersion”int RDxfServices::getMajorVersion() constinline const
getMinorVersion
Section titled “getMinorVersion”int RDxfServices::getMinorVersion() constinline const
getPatchVersion
Section titled “getPatchVersion”int RDxfServices::getPatchVersion() constinline const
getVersion2Compatibility
Section titled “getVersion2Compatibility”bool RDxfServices::getVersion2Compatibility() constinline const
getVersion2DimensionLabel
Section titled “getVersion2DimensionLabel”QString RDxfServices::getVersion2DimensionLabel(const QString &handle) constconst
getVersion2Font
Section titled “getVersion2Font”QString RDxfServices::getVersion2Font(const QString &handle) constconst
getVersion2LayerName
Section titled “getVersion2LayerName”QString RDxfServices::getVersion2LayerName(const QString &layerName) constconst
getVersion2PatternAngle
Section titled “getVersion2PatternAngle”double RDxfServices::getVersion2PatternAngle(double angle, const QString &patternName) constconst
getVersion2PatternName
Section titled “getVersion2PatternName”QString RDxfServices::getVersion2PatternName(const QString &patternName) constconst
getVersion2PatternScale
Section titled “getVersion2PatternScale”double RDxfServices::getVersion2PatternScale(double scale, const QString &patternName) constconst
Parameters:
scale: Old QCAD 2 pattern scale.patternName: Old QCAD 2 pattern name.
getVersion3_1Compatibility
Section titled “getVersion3_1Compatibility”bool RDxfServices::getVersion3_1Compatibility() constinline const
getVersionBlockName
Section titled “getVersionBlockName”QString RDxfServices::getVersionBlockName(const QString &blockName) constconst
hasDIMAZIN
Section titled “hasDIMAZIN”bool RDxfServices::hasDIMAZIN() constinline const
hasDIMZIN
Section titled “hasDIMZIN”bool RDxfServices::hasDIMZIN() constinline const
hasInvalidEllipse
Section titled “hasInvalidEllipse”bool RDxfServices::hasInvalidEllipse() constinline const
void RDxfServices::reset()setCodec
Section titled “setCodec”void RDxfServices::setCodec(QTextCodec *codec)inline
attributesToColor
Section titled “attributesToColor”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’.
autoFixLinetypePattern
Section titled “autoFixLinetypePattern”static void RDxfServices::autoFixLinetypePattern(RLinetypePattern &pattern)static
colorToNumber
Section titled “colorToNumber”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.
colorToNumber24
Section titled “colorToNumber24”static int RDxfServices::colorToNumber24(const RColor &col)static
Returns: 24 bit color as DXF prepared int.
decodeMifString
Section titled “decodeMifString”static QString RDxfServices::decodeMifString(const QString &input)static
escapeUnicode
Section titled “escapeUnicode”static QString RDxfServices::escapeUnicode(const QString &str)static
getAci
Section titled “getAci”static int RDxfServices::getAci(const RColor &col)static
getCodeForVariable
Section titled “getCodeForVariable”static int RDxfServices::getCodeForVariable(RS::KnownVariable v)static
getColor
Section titled “getColor”static RColor RDxfServices::getColor(unsigned int index)static
getDxfServicesProxy
Section titled “getDxfServicesProxy”static RDxfServicesProxy * RDxfServices::getDxfServicesProxy()static inline
Non-Scriptable: This function is not available in script environments.
getFileQCADVersion
Section titled “getFileQCADVersion”static int RDxfServices::getFileQCADVersion(const RDocument &doc)static
getSafeBlockName
Section titled “getSafeBlockName”static QString RDxfServices::getSafeBlockName(QString &blockName)static
getTypeForVariable
Section titled “getTypeForVariable”static RDxfServices::Type RDxfServices::getTypeForVariable(RS::KnownVariable v)static
hasProxy
Section titled “hasProxy”static bool RDxfServices::hasProxy()static inline
initAci
Section titled “initAci”static void RDxfServices::initAci()static
isVariable2D
Section titled “isVariable2D”static bool RDxfServices::isVariable2D(RS::KnownVariable v)static
Checks if the given variable is two-dimensional (e.g.
$LIMMIN).
numberToColor
Section titled “numberToColor”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)
numberToColor24
Section titled “numberToColor24”static RColor RDxfServices::numberToColor24(int num)static
Returns: color object from DXF coded integer 24 bit color number.
numberToWeight
Section titled “numberToWeight”static RLineweight::Lineweight RDxfServices::numberToWeight(int num)static
Converts a line width number (e.g.
- into a RS2::LineWidth.
parseUnicode
Section titled “parseUnicode”static QString RDxfServices::parseUnicode(const QString &str)static
setDxfServicesProxy
Section titled “setDxfServicesProxy”static void RDxfServices::setDxfServicesProxy(RDxfServicesProxy *p)static inline
Non-Scriptable: This function is not available in script environments.
stringToVariable
Section titled “stringToVariable”static RS::KnownVariable RDxfServices::stringToVariable(const QString &s)static
variableToString
Section titled “variableToString”static QString RDxfServices::variableToString(RS::KnownVariable v)static
widthToNumber
Section titled “widthToNumber”static int RDxfServices::widthToNumber(RLineweight::Lineweight w)static
Converts a RLineweight::Lineweight into an int width for use in DXF files.
QTextCodec* RDxfServices::codecprivate
dxflibMajorVersion
Section titled “dxflibMajorVersion”int RDxfServices::dxflibMajorVersionprivate
dxflibMinorVersion
Section titled “dxflibMinorVersion”int RDxfServices::dxflibMinorVersionprivate
dxflibPatchVersion
Section titled “dxflibPatchVersion”int RDxfServices::dxflibPatchVersionprivate
version2BlockMapping
Section titled “version2BlockMapping”QMap<QString, QString> RDxfServices::version2BlockMappingprivate
version2DimensionLabels
Section titled “version2DimensionLabels”QMap<QString, QString> RDxfServices::version2DimensionLabelsprivate
version2GotDIMAZIN
Section titled “version2GotDIMAZIN”bool RDxfServices::version2GotDIMAZINprivate
version2GotDIMZIN
Section titled “version2GotDIMZIN”bool RDxfServices::version2GotDIMZINprivate
version2GotInvalidEllipse
Section titled “version2GotInvalidEllipse”bool RDxfServices::version2GotInvalidEllipseprivate
version2LayerMapping
Section titled “version2LayerMapping”QMap<QString, QString> RDxfServices::version2LayerMappingprivate
version2TextFonts
Section titled “version2TextFonts”QMap<QString, QString> RDxfServices::version2TextFontsprivate
static QMap< unsigned int, QRgb > RDxfServices::acistatic 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.
dxfServicesProxy
Section titled “dxfServicesProxy”static RDxfServicesProxy * RDxfServices::dxfServicesProxy = NULLstatic private
revAci
Section titled “revAci”static QMap< QRgb, unsigned int > RDxfServices::revAcistatic private