QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
RDxfServices Class Reference

DXF support tools, mainly for QCAD 2 DXF imports. More...

#include <RDxfServices.h>

Public Types

enum  Type {
  Unknown , String , Int , Float ,
  Vector
}
 

Public Member Functions

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
 
 RDxfServices ()
 
void reset ()
 
void setCodec (QTextCodec *codec)
 
 ~RDxfServices ()
 

Static Public Member 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 escapeUnicode (const QString &str)
 
static int getAci (const RColor &col)
 
static int getCodeForVariable (RS::KnownVariable v)
 
static RColor getColor (unsigned int index)
 
static int getFileQCADVersion (const RDocument &doc)
 
static QString getSafeBlockName (QString &blockName)
 
static RDxfServices::Type getTypeForVariable (RS::KnownVariable v)
 
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 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

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

static QMap< unsigned int, QRgb > aci
 Copyright (c) 2011-2018 by Andrew Mustun.
 
static QMap< QRgb, unsigned int > revAci
 

Detailed Description

DXF support tools, mainly for QCAD 2 DXF imports.

Scriptable:\nThis class is available in script environments.\n
Copyable:\nObjects are cleaned up automatically by the garbage collector of the script engine.\n

Member Enumeration Documentation

◆ Type

Enumerator
Unknown 
String 
Int 
Float 
Vector 

Constructor & Destructor Documentation

◆ RDxfServices()

RDxfServices::RDxfServices ( )

◆ ~RDxfServices()

RDxfServices::~RDxfServices ( )

Member Function Documentation

◆ attributesToColor()

RColor RDxfServices::attributesToColor ( int color,
int color24,
const double dxfColors[][3],
bool forLayer = false )
static
Non-Scriptable:\nThis function is not available in script environments.\n
Returns
Pen with the same attributes as 'attributes'.

◆ autoFixLinetypePattern()

void RDxfServices::autoFixLinetypePattern ( RLinetypePattern & pattern)
static

◆ 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.

◆ colorToNumber()

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

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

Non-Scriptable:\nThis function is not available in script environments.\n

The color that fits best is chosen.

◆ colorToNumber24()

int RDxfServices::colorToNumber24 ( const RColor & col)
static
Returns
24 bit color as DXF prepared int.

◆ detectVersion2Format()

void RDxfServices::detectVersion2Format ( const QString & fileName)

◆ escapeUnicode()

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

◆ fixBlockName()

void RDxfServices::fixBlockName ( QString & blockName)

◆ fixDimensionLabel()

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

◆ fixFontName()

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

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

◆ fixLayerName()

void RDxfServices::fixLayerName ( QString & layerName)

◆ fixVersion2HatchData()

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

◆ fixVersion2String()

void RDxfServices::fixVersion2String ( QString & str) const

◆ getAci()

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

◆ getCodec()

QTextCodec * RDxfServices::getCodec ( ) const
inline

◆ getCodeForVariable()

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

◆ getColor()

RColor RDxfServices::getColor ( unsigned int index)
static

◆ getFileQCADVersion()

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

◆ getMajorVersion()

int RDxfServices::getMajorVersion ( ) const
inline

◆ getMinorVersion()

int RDxfServices::getMinorVersion ( ) const
inline

◆ getPatchVersion()

int RDxfServices::getPatchVersion ( ) const
inline

◆ getSafeBlockName()

QString RDxfServices::getSafeBlockName ( QString & blockName)
static

◆ getTypeForVariable()

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

◆ getVersion2Compatibility()

bool RDxfServices::getVersion2Compatibility ( ) const
inline

◆ getVersion2DimensionLabel()

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

◆ getVersion2Font()

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

◆ getVersion2LayerName()

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

◆ getVersion2PatternAngle()

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

◆ getVersion2PatternName()

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

◆ getVersion2PatternScale()

double RDxfServices::getVersion2PatternScale ( double scale,
const QString & patternName ) const
Parameters
scaleOld QCAD 2 pattern scale.
patternNameOld QCAD 2 pattern name.

◆ getVersion3_1Compatibility()

bool RDxfServices::getVersion3_1Compatibility ( ) const
inline

◆ getVersionBlockName()

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

◆ hasDIMAZIN()

bool RDxfServices::hasDIMAZIN ( ) const
inline

◆ hasDIMZIN()

bool RDxfServices::hasDIMZIN ( ) const
inline

◆ hasInvalidEllipse()

bool RDxfServices::hasInvalidEllipse ( ) const
inline

◆ initAci()

void RDxfServices::initAci ( )
static

◆ isVariable2D()

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

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

$LIMMIN).

◆ numberToColor()

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:\nThis function is not available in script environments.\n

Please refer to the dxflib documentation for details.

Parameters
numColor number.
compCompatibility with older QCad versions (1.5.3 and older)

◆ numberToColor24()

RColor RDxfServices::numberToColor24 ( int num)
static
Returns
color object from DXF coded integer 24 bit color number.

◆ numberToWeight()

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

Converts a line width number (e.g.

1) into a RS2::LineWidth.

◆ parseUnicode()

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

◆ reset()

void RDxfServices::reset ( )

◆ setCodec()

void RDxfServices::setCodec ( QTextCodec * codec)
inline

◆ stringToVariable()

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

◆ variableToString()

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

◆ widthToNumber()

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

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

Member Data Documentation

◆ aci

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

Copyright (c) 2011-2018 by Andrew Mustun.

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.

◆ codec

QTextCodec* RDxfServices::codec
private

◆ dxflibMajorVersion

int RDxfServices::dxflibMajorVersion
private

◆ dxflibMinorVersion

int RDxfServices::dxflibMinorVersion
private

◆ dxflibPatchVersion

int RDxfServices::dxflibPatchVersion
private

◆ revAci

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

◆ version2BlockMapping

QMap<QString, QString> RDxfServices::version2BlockMapping
private

◆ version2DimensionLabels

QMap<QString, QString> RDxfServices::version2DimensionLabels
private

◆ version2GotDIMAZIN

bool RDxfServices::version2GotDIMAZIN
private

◆ version2GotDIMZIN

bool RDxfServices::version2GotDIMZIN
private

◆ version2GotInvalidEllipse

bool RDxfServices::version2GotInvalidEllipse
private

◆ version2LayerMapping

QMap<QString, QString> RDxfServices::version2LayerMapping
private

◆ version2TextFonts

QMap<QString, QString> RDxfServices::version2TextFonts
private

The documentation for this class was generated from the following files: