KiCad PCB EDA Suite
Loading...
Searching...
No Matches
DXF_IMPORT_PLUGIN Class Reference

#include <dxf_import_plugin.h>

Inheritance diagram for DXF_IMPORT_PLUGIN:
GRAPHICS_IMPORT_PLUGIN

Public Member Functions

 DXF_IMPORT_PLUGIN ()
 
 ~DXF_IMPORT_PLUGIN ()
 
const wxString GetName () const override
 Return the plugin name.
 
const std::vector< std::string > GetFileExtensions () const override
 Return a vector of the file extensions handled by this plugin.
 
bool Load (const wxString &aFileName) override
 Load file for import.
 
bool LoadFromMemory (const wxMemoryBuffer &aMemBuffer) override
 Set memory buffer with content for import.
 
bool Import () override
 Actually imports the file.
 
double GetImageWidth () const override
 Return image width from original imported file.
 
double GetImageHeight () const override
 Return image height from original imported file.
 
BOX2D GetImageBBox () const override
 Return image bounding box from original imported file.
 
void updateImageLimits (const VECTOR2D &aPoint)
 
virtual void SetImporter (GRAPHICS_IMPORTER *aImporter) override
 Set the receiver of the imported shapes.
 
void ImportAsFootprintGraphic (bool aImportAsFootprintGraphic)
 Allow the import DXF items converted to board graphic items or footprint graphic items.
 
void SetUnit (DXF_IMPORT_UNITS aUnit)
 Set the default units when importing DXFs.
 
void SetDefaultLineWidthMM (double aWidth)
 Set the default line width when importing dxf items like lines to Pcbnew.
 
void SetLineWidthMM (double aWidth) override
 
void SetOffset (double aOffsetX, double aOffsetY)
 Set the coordinate offset between the imported dxf items and Pcbnew.
 
void SetBrdLayer (int aBrdLayer)
 Set the layer number to import dxf items.
 
bool ImportDxfFile (const wxString &aFile)
 Implementation of the method used for communicate with this filter.
 
bool ImportDxfFile (const wxMemoryBuffer &aMemBuffer)
 Implementation of the method used for communicate with this filter.
 
const wxString & GetMessages () const override
 
void ReportMsg (const wxString &aMessage) override
 
wxString GetWildcards () const
 Return a list of wildcards that contains the file extensions handled by this plugin, separated with a semi-colon.
 

Protected Attributes

GRAPHICS_IMPORTERm_importer
 < Importer used to create objects representing the imported shapes.
 

Private Member Functions

double mapX (double aDxfCoordX)
 
double mapY (double aDxfCoordY)
 
double mapDim (double aDxfValue)
 
double lineWeightToWidth (int lw, DXF_IMPORT_LAYER *aLayer)
 
double getCurrentUnitScale ()
 
MATRIX3x3D getArbitraryAxis (DL_Extrusion *aData)
 
VECTOR3D wcsToOcs (const MATRIX3x3D &arbitraryAxis, VECTOR3D point)
 Converts a given world coordinate point to object coordinate using the given arbitrary axis vectors.
 
VECTOR3D ocsToWcs (const MATRIX3x3D &arbitraryAxis, VECTOR3D point)
 Converts a given object coordinate point to world coordinate using the given arbitrary axis vectors.
 
DXF_IMPORT_LAYERgetImportLayer (const std::string &aLayerName)
 Return the import layer data.
 
DXF_IMPORT_BLOCKgetImportBlock (const std::string &aBlockName)
 Return the import layer block.
 
DXF_IMPORT_STYLEgetImportStyle (const std::string &aStyleName)
 Return the import style.
 
void insertLine (const VECTOR2D &aSegStart, const VECTOR2D &aSegEnd, double aWidth)
 
void insertArc (const VECTOR2D &aSegStart, const VECTOR2D &aSegEnd, double aBulge, double aWidth)
 
void insertSpline (double aWidth)
 
virtual void setVariableString (const std::string &key, const std::string &value, int code) override
 Called for every string variable in the DXF file (e.g.
 
virtual void setVariableInt (const std::string &key, int value, int code) override
 Called for every int variable in the DXF file (e.g.
 
virtual void setVariableDouble (const std::string &key, double value, int code) override
 Called for every double variable in the DXF file (e.g.
 
virtual void addLayer (const DL_LayerData &aData) override
 
virtual void addLine (const DL_LineData &aData) override
 
virtual void addLinetype (const DL_LinetypeData &data) override
 
virtual void addBlock (const DL_BlockData &) override
 Called for each BLOCK in the DXF file.
 
virtual void endBlock () override
 
virtual void addTextStyle (const DL_StyleData &aData) override
 
virtual void addPoint (const DL_PointData &aData) override
 
virtual void addCircle (const DL_CircleData &aData) override
 
virtual void addArc (const DL_ArcData &aData) override
 
void addEllipse (const DL_EllipseData &aData) override
 
virtual void addText (const DL_TextData &aData) override
 
virtual void addPolyline (const DL_PolylineData &aData) override
 
virtual void addInsert (const DL_InsertData &aData) override
 
virtual void addVertex (const DL_VertexData &aData) override
 Called for every polyline vertex.
 
virtual void addMTextChunk (const std::string &text) override
 
virtual void addMText (const DL_MTextData &aData) override
 
virtual void endEntity () override
 
virtual void addSpline (const DL_SplineData &aData) override
 Called for every spline.
 
virtual void addControlPoint (const DL_ControlPointData &aData) override
 Called for every spline control point.
 
virtual void addFitPoint (const DL_FitPointData &aData) override
 Called for every spline fit point.
 
virtual void addKnot (const DL_KnotData &aData) override
 Called for every spline knot value.
 
virtual void addXLine (const DL_XLineData &) override
 
virtual void addRay (const DL_RayData &) override
 
virtual void addArcAlignedText (const DL_ArcAlignedTextData &) override
 
virtual void addDimAlign (const DL_DimensionData &, const DL_DimAlignedData &) override
 
virtual void addDimLinear (const DL_DimensionData &, const DL_DimLinearData &) override
 
virtual void addDimRadial (const DL_DimensionData &, const DL_DimRadialData &) override
 
virtual void addDimDiametric (const DL_DimensionData &, const DL_DimDiametricData &) override
 
virtual void addDimAngular (const DL_DimensionData &, const DL_DimAngular2LData &) override
 
virtual void addDimAngular3P (const DL_DimensionData &, const DL_DimAngular3PData &) override
 
virtual void addDimOrdinate (const DL_DimensionData &, const DL_DimOrdinateData &) override
 
virtual void addLeader (const DL_LeaderData &) override
 
virtual void addLeaderVertex (const DL_LeaderVertexData &) override
 
virtual void addHatch (const DL_HatchData &) override
 
virtual void addHatchLoop (const DL_HatchLoopData &) override
 
virtual void addHatchEdge (const DL_HatchEdgeData &) override
 
virtual void addTrace (const DL_TraceData &) override
 
virtual void add3dFace (const DL_3dFaceData &) override
 
virtual void addSolid (const DL_SolidData &) override
 
virtual void addImage (const DL_ImageData &) override
 
virtual void linkImage (const DL_ImageDefData &) override
 
virtual void addAttribute (const DL_AttributeData &) override
 
virtual void addXRecord (const std::string &) override
 
virtual void addXRecordString (int, const std::string &) override
 
virtual void addXRecordReal (int, double) override
 
virtual void addXRecordInt (int, int) override
 
virtual void addXRecordBool (int, bool) override
 
virtual void addXDataApp (const std::string &) override
 
virtual void addXDataString (int, const std::string &) override
 
virtual void addXDataReal (int, double) override
 
virtual void addXDataInt (int, int) override
 
void writeLine ()
 
void writeMtext ()
 

Static Private Member Functions

static wxString toDxfString (const wxString &aStr)
 Convert a native Unicode string into a DXF encoded string.
 
static wxString toNativeString (const wxString &aData)
 Convert a DXF encoded string into a native Unicode string.
 

Private Attributes

double m_xOffset
 
double m_yOffset
 
double m_defaultThickness
 
int m_brdLayer
 
int m_version
 
std::string m_codePage
 
bool m_importAsFPShapes
 
wxString m_messages
 
DXF2BRD_ENTITY_DATA m_curr_entity
 
std::string m_mtextContent
 
double m_minX
 
double m_maxX
 
double m_minY
 
double m_maxY
 
DXF_IMPORT_UNITS m_currentUnit
 
int m_importCoordinatePrecision
 
int m_importAnglePrecision
 
GRAPHICS_IMPORTER_BUFFER m_internalImporter
 
std::vector< std::unique_ptr< DXF_IMPORT_LAYER > > m_layers
 
std::vector< std::unique_ptr< DXF_IMPORT_BLOCK > > m_blocks
 
std::vector< std::unique_ptr< DXF_IMPORT_STYLE > > m_styles
 
DXF_IMPORT_BLOCKm_currentBlock
 

Detailed Description

Definition at line 213 of file dxf_import_plugin.h.

Constructor & Destructor Documentation

◆ DXF_IMPORT_PLUGIN()

◆ ~DXF_IMPORT_PLUGIN()

DXF_IMPORT_PLUGIN::~DXF_IMPORT_PLUGIN ( )

Definition at line 115 of file dxf_import_plugin.cpp.

Member Function Documentation

◆ add3dFace()

virtual void DXF_IMPORT_PLUGIN::add3dFace ( const DL_3dFaceData &  )
inlineoverrideprivatevirtual

Definition at line 518 of file dxf_import_plugin.h.

References _, and ReportMsg().

◆ addArc()

◆ addArcAlignedText()

virtual void DXF_IMPORT_PLUGIN::addArcAlignedText ( const DL_ArcAlignedTextData &  )
inlineoverrideprivatevirtual

Definition at line 467 of file dxf_import_plugin.h.

References _, and ReportMsg().

◆ addAttribute()

virtual void DXF_IMPORT_PLUGIN::addAttribute ( const DL_AttributeData &  )
inlineoverrideprivatevirtual

Definition at line 535 of file dxf_import_plugin.h.

◆ addBlock()

void DXF_IMPORT_PLUGIN::addBlock ( const DL_BlockData &  aData)
overrideprivatevirtual

Called for each BLOCK in the DXF file.

These are re-usable elements that may be placed into the model space. The elements are dereferenced to the model, so we just need to skip the re-parsing for the block elements.

Definition at line 505 of file dxf_import_plugin.cpp.

References m_blocks, m_currentBlock, and name.

◆ addCircle()

void DXF_IMPORT_PLUGIN::addCircle ( const DL_CircleData &  aData)
overrideprivatevirtual

◆ addControlPoint()

void DXF_IMPORT_PLUGIN::addControlPoint ( const DL_ControlPointData &  aData)
overrideprivatevirtual

Called for every spline control point.

Definition at line 276 of file dxf_import_plugin.cpp.

References m_curr_entity, and DXF2BRD_ENTITY_DATA::m_SplineControlPointList.

◆ addDimAlign()

virtual void DXF_IMPORT_PLUGIN::addDimAlign ( const DL_DimensionData &  ,
const DL_DimAlignedData &   
)
inlineoverrideprivatevirtual

Definition at line 472 of file dxf_import_plugin.h.

References _, and ReportMsg().

◆ addDimAngular()

virtual void DXF_IMPORT_PLUGIN::addDimAngular ( const DL_DimensionData &  ,
const DL_DimAngular2LData &   
)
inlineoverrideprivatevirtual

Definition at line 488 of file dxf_import_plugin.h.

References _, and ReportMsg().

◆ addDimAngular3P()

virtual void DXF_IMPORT_PLUGIN::addDimAngular3P ( const DL_DimensionData &  ,
const DL_DimAngular3PData &   
)
inlineoverrideprivatevirtual

Definition at line 492 of file dxf_import_plugin.h.

References _, and ReportMsg().

◆ addDimDiametric()

virtual void DXF_IMPORT_PLUGIN::addDimDiametric ( const DL_DimensionData &  ,
const DL_DimDiametricData &   
)
inlineoverrideprivatevirtual

Definition at line 484 of file dxf_import_plugin.h.

References _, and ReportMsg().

◆ addDimLinear()

virtual void DXF_IMPORT_PLUGIN::addDimLinear ( const DL_DimensionData &  ,
const DL_DimLinearData &   
)
inlineoverrideprivatevirtual

Definition at line 476 of file dxf_import_plugin.h.

References _, and ReportMsg().

◆ addDimOrdinate()

virtual void DXF_IMPORT_PLUGIN::addDimOrdinate ( const DL_DimensionData &  ,
const DL_DimOrdinateData &   
)
inlineoverrideprivatevirtual

Definition at line 496 of file dxf_import_plugin.h.

References _, and ReportMsg().

◆ addDimRadial()

virtual void DXF_IMPORT_PLUGIN::addDimRadial ( const DL_DimensionData &  ,
const DL_DimRadialData &   
)
inlineoverrideprivatevirtual

Definition at line 480 of file dxf_import_plugin.h.

References _, and ReportMsg().

◆ addEllipse()

◆ addFitPoint()

void DXF_IMPORT_PLUGIN::addFitPoint ( const DL_FitPointData &  aData)
overrideprivatevirtual

Called for every spline fit point.

Definition at line 283 of file dxf_import_plugin.cpp.

References m_curr_entity, and DXF2BRD_ENTITY_DATA::m_SplineFitPointList.

◆ addHatch()

virtual void DXF_IMPORT_PLUGIN::addHatch ( const DL_HatchData &  )
inlineoverrideprivatevirtual

Definition at line 506 of file dxf_import_plugin.h.

References _, and ReportMsg().

◆ addHatchEdge()

virtual void DXF_IMPORT_PLUGIN::addHatchEdge ( const DL_HatchEdgeData &  )
inlineoverrideprivatevirtual

Definition at line 511 of file dxf_import_plugin.h.

◆ addHatchLoop()

virtual void DXF_IMPORT_PLUGIN::addHatchLoop ( const DL_HatchLoopData &  )
inlineoverrideprivatevirtual

Definition at line 510 of file dxf_import_plugin.h.

◆ addImage()

virtual void DXF_IMPORT_PLUGIN::addImage ( const DL_ImageData &  )
inlineoverrideprivatevirtual

Definition at line 528 of file dxf_import_plugin.h.

References _, and ReportMsg().

◆ addInsert()

◆ addKnot()

void DXF_IMPORT_PLUGIN::addKnot ( const DL_KnotData &  aData)
overrideprivatevirtual

Called for every spline knot value.

Definition at line 291 of file dxf_import_plugin.cpp.

References m_curr_entity, and DXF2BRD_ENTITY_DATA::m_SplineKnotsList.

◆ addLayer()

void DXF_IMPORT_PLUGIN::addLayer ( const DL_LayerData &  aData)
overrideprivatevirtual

◆ addLeader()

virtual void DXF_IMPORT_PLUGIN::addLeader ( const DL_LeaderData &  )
inlineoverrideprivatevirtual

Definition at line 500 of file dxf_import_plugin.h.

References _, and ReportMsg().

◆ addLeaderVertex()

virtual void DXF_IMPORT_PLUGIN::addLeaderVertex ( const DL_LeaderVertexData &  )
inlineoverrideprivatevirtual

Definition at line 504 of file dxf_import_plugin.h.

◆ addLine()

void DXF_IMPORT_PLUGIN::addLine ( const DL_LineData &  aData)
overrideprivatevirtual

◆ addLinetype()

void DXF_IMPORT_PLUGIN::addLinetype ( const DL_LinetypeData &  data)
overrideprivatevirtual

Definition at line 313 of file dxf_import_plugin.cpp.

References From_UTF8(), and name.

◆ addMText()

◆ addMTextChunk()

void DXF_IMPORT_PLUGIN::addMTextChunk ( const std::string &  text)
overrideprivatevirtual

Definition at line 843 of file dxf_import_plugin.cpp.

References m_mtextContent, and text.

◆ addPoint()

void DXF_IMPORT_PLUGIN::addPoint ( const DL_PointData &  aData)
overrideprivatevirtual

◆ addPolyline()

void DXF_IMPORT_PLUGIN::addPolyline ( const DL_PolylineData &  aData)
overrideprivatevirtual

◆ addRay()

virtual void DXF_IMPORT_PLUGIN::addRay ( const DL_RayData &  )
inlineoverrideprivatevirtual

Definition at line 462 of file dxf_import_plugin.h.

References _, and ReportMsg().

◆ addSolid()

virtual void DXF_IMPORT_PLUGIN::addSolid ( const DL_SolidData &  )
inlineoverrideprivatevirtual

Definition at line 523 of file dxf_import_plugin.h.

References _, and ReportMsg().

◆ addSpline()

◆ addText()

◆ addTextStyle()

void DXF_IMPORT_PLUGIN::addTextStyle ( const DL_StyleData &  aData)
overrideprivatevirtual

Definition at line 1346 of file dxf_import_plugin.cpp.

References m_styles, and name.

◆ addTrace()

virtual void DXF_IMPORT_PLUGIN::addTrace ( const DL_TraceData &  )
inlineoverrideprivatevirtual

Definition at line 513 of file dxf_import_plugin.h.

References _, and ReportMsg().

◆ addVertex()

◆ addXDataApp()

virtual void DXF_IMPORT_PLUGIN::addXDataApp ( const std::string &  )
inlineoverrideprivatevirtual

Definition at line 541 of file dxf_import_plugin.h.

◆ addXDataInt()

virtual void DXF_IMPORT_PLUGIN::addXDataInt ( int  ,
int   
)
inlineoverrideprivatevirtual

Definition at line 544 of file dxf_import_plugin.h.

◆ addXDataReal()

virtual void DXF_IMPORT_PLUGIN::addXDataReal ( int  ,
double   
)
inlineoverrideprivatevirtual

Definition at line 543 of file dxf_import_plugin.h.

◆ addXDataString()

virtual void DXF_IMPORT_PLUGIN::addXDataString ( int  ,
const std::string &   
)
inlineoverrideprivatevirtual

Definition at line 542 of file dxf_import_plugin.h.

◆ addXLine()

virtual void DXF_IMPORT_PLUGIN::addXLine ( const DL_XLineData &  )
inlineoverrideprivatevirtual

Definition at line 458 of file dxf_import_plugin.h.

References _, and ReportMsg().

◆ addXRecord()

virtual void DXF_IMPORT_PLUGIN::addXRecord ( const std::string &  )
inlineoverrideprivatevirtual

Definition at line 536 of file dxf_import_plugin.h.

◆ addXRecordBool()

virtual void DXF_IMPORT_PLUGIN::addXRecordBool ( int  ,
bool   
)
inlineoverrideprivatevirtual

Definition at line 540 of file dxf_import_plugin.h.

◆ addXRecordInt()

virtual void DXF_IMPORT_PLUGIN::addXRecordInt ( int  ,
int   
)
inlineoverrideprivatevirtual

Definition at line 539 of file dxf_import_plugin.h.

◆ addXRecordReal()

virtual void DXF_IMPORT_PLUGIN::addXRecordReal ( int  ,
double   
)
inlineoverrideprivatevirtual

Definition at line 538 of file dxf_import_plugin.h.

◆ addXRecordString()

virtual void DXF_IMPORT_PLUGIN::addXRecordString ( int  ,
const std::string &   
)
inlineoverrideprivatevirtual

Definition at line 537 of file dxf_import_plugin.h.

◆ endBlock()

void DXF_IMPORT_PLUGIN::endBlock ( )
overrideprivatevirtual

Definition at line 518 of file dxf_import_plugin.cpp.

References m_currentBlock.

◆ endEntity()

◆ getArbitraryAxis()

MATRIX3x3D DXF_IMPORT_PLUGIN::getArbitraryAxis ( DL_Extrusion *  aData)
private

◆ getCurrentUnitScale()

double DXF_IMPORT_PLUGIN::getCurrentUnitScale ( )
private

Definition at line 998 of file dxf_import_plugin.cpp.

References m_currentUnit, and scale.

Referenced by mapDim(), mapX(), and mapY().

◆ GetFileExtensions()

const std::vector< std::string > DXF_IMPORT_PLUGIN::GetFileExtensions ( ) const
inlineoverridevirtual

Return a vector of the file extensions handled by this plugin.

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 224 of file dxf_import_plugin.h.

◆ GetImageBBox()

BOX2D DXF_IMPORT_PLUGIN::GetImageBBox ( ) const
overridevirtual

Return image bounding box from original imported file.

Returns
Image bounding box.

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 181 of file dxf_import_plugin.cpp.

References m_maxX, m_maxY, m_minX, m_minY, BOX2< Vec >::SetEnd(), and BOX2< Vec >::SetOrigin().

◆ GetImageHeight()

double DXF_IMPORT_PLUGIN::GetImageHeight ( ) const
overridevirtual

Return image height from original imported file.

Returns
Original Image height in mm.

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 175 of file dxf_import_plugin.cpp.

References m_maxY, and m_minY.

◆ GetImageWidth()

double DXF_IMPORT_PLUGIN::GetImageWidth ( ) const
overridevirtual

Return image width from original imported file.

Returns
Original Image width in mm.

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 169 of file dxf_import_plugin.cpp.

References m_maxX, and m_minX.

◆ getImportBlock()

DXF_IMPORT_BLOCK * DXF_IMPORT_PLUGIN::getImportBlock ( const std::string &  aBlockName)
private

Return the import layer block.

Parameters
aBlockNameis the raw string from dxflib.
Returns
The given block by name or nullptr if not found.

Definition at line 358 of file dxf_import_plugin.cpp.

References m_blocks.

Referenced by addInsert().

◆ getImportLayer()

DXF_IMPORT_LAYER * DXF_IMPORT_PLUGIN::getImportLayer ( const std::string &  aLayerName)
private

Return the import layer data.

Parameters
aLayerNameis the raw string from dxflib getLayer().
Returns
The given layer by name or the placeholder layer inserted in the constructor.

Definition at line 337 of file dxf_import_plugin.cpp.

References m_layers.

Referenced by addArc(), addCircle(), addEllipse(), addLine(), addVertex(), and endEntity().

◆ getImportStyle()

DXF_IMPORT_STYLE * DXF_IMPORT_PLUGIN::getImportStyle ( const std::string &  aStyleName)
private

Return the import style.

Parameters
aStyleNameis the raw string from dxflib.
Returns
The given style by name or nullptr if not found.

Definition at line 379 of file dxf_import_plugin.cpp.

References m_styles.

Referenced by addMText(), and addText().

◆ GetMessages()

const wxString & DXF_IMPORT_PLUGIN::GetMessages ( ) const
inlineoverridevirtual
Returns
the list of messages in one string. Each message ends by '
'

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 319 of file dxf_import_plugin.h.

References m_messages.

◆ GetName()

const wxString DXF_IMPORT_PLUGIN::GetName ( ) const
inlineoverridevirtual

Return the plugin name.

This string will be used as the description in the file dialog.

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 219 of file dxf_import_plugin.h.

◆ GetWildcards()

wxString GRAPHICS_IMPORT_PLUGIN::GetWildcards ( ) const
inlineinherited

Return a list of wildcards that contains the file extensions handled by this plugin, separated with a semi-colon.

Definition at line 65 of file graphics_import_plugin.h.

References formatWildcardExt(), and GRAPHICS_IMPORT_PLUGIN::GetFileExtensions().

◆ Import()

bool DXF_IMPORT_PLUGIN::Import ( )
overridevirtual

Actually imports the file.

It is necessary to have loaded the file beforehand.

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 160 of file dxf_import_plugin.cpp.

References GRAPHICS_IMPORTER_BUFFER::ImportTo(), GRAPHICS_IMPORT_PLUGIN::m_importer, and m_internalImporter.

◆ ImportAsFootprintGraphic()

void DXF_IMPORT_PLUGIN::ImportAsFootprintGraphic ( bool  aImportAsFootprintGraphic)
inline

Allow the import DXF items converted to board graphic items or footprint graphic items.

Parameters
aImportAsFootprintGraphicuse true to import in a footprint or false to import on a board.

Definition at line 248 of file dxf_import_plugin.h.

References m_importAsFPShapes.

◆ ImportDxfFile() [1/2]

bool DXF_IMPORT_PLUGIN::ImportDxfFile ( const wxMemoryBuffer &  aMemBuffer)

Implementation of the method used for communicate with this filter.

Parameters
aMemBufferis the memory bufferr.

Definition at line 236 of file dxf_import_plugin.cpp.

◆ ImportDxfFile() [2/2]

bool DXF_IMPORT_PLUGIN::ImportDxfFile ( const wxString &  aFile)

Implementation of the method used for communicate with this filter.

Parameters
aFileis the full filename.

Definition at line 218 of file dxf_import_plugin.cpp.

Referenced by Load(), and LoadFromMemory().

◆ insertArc()

void DXF_IMPORT_PLUGIN::insertArc ( const VECTOR2D aSegStart,
const VECTOR2D aSegEnd,
double  aBulge,
double  aWidth 
)
private

◆ insertLine()

void DXF_IMPORT_PLUGIN::insertLine ( const VECTOR2D aSegStart,
const VECTOR2D aSegEnd,
double  aWidth 
)
private

◆ insertSpline()

◆ lineWeightToWidth()

double DXF_IMPORT_PLUGIN::lineWeightToWidth ( int  lw,
DXF_IMPORT_LAYER aLayer 
)
private

◆ linkImage()

virtual void DXF_IMPORT_PLUGIN::linkImage ( const DL_ImageDefData &  )
inlineoverrideprivatevirtual

Definition at line 532 of file dxf_import_plugin.h.

◆ Load()

bool DXF_IMPORT_PLUGIN::Load ( const wxString &  aFileName)
overridevirtual

Load file for import.

It is necessary to have the GRAPHICS_IMPORTER object set before.

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 120 of file dxf_import_plugin.cpp.

References _, GRAPHICS_IMPORTER_BUFFER::ClearShapes(), ImportDxfFile(), m_blocks, m_internalImporter, m_layers, m_styles, and ReportMsg().

◆ LoadFromMemory()

bool DXF_IMPORT_PLUGIN::LoadFromMemory ( const wxMemoryBuffer &  aMemBuffer)
overridevirtual

Set memory buffer with content for import.

It is necessary to have the GRAPHICS_IMPORTER object set before.

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 140 of file dxf_import_plugin.cpp.

References _, GRAPHICS_IMPORTER_BUFFER::ClearShapes(), ImportDxfFile(), m_blocks, m_internalImporter, m_layers, m_styles, and ReportMsg().

◆ mapDim()

double DXF_IMPORT_PLUGIN::mapDim ( double  aDxfValue)
private

Definition at line 212 of file dxf_import_plugin.cpp.

References getCurrentUnitScale(), and SCALE_FACTOR.

Referenced by addArc(), addCircle(), addMText(), addPoint(), and addText().

◆ mapX()

double DXF_IMPORT_PLUGIN::mapX ( double  aDxfCoordX)
private

◆ mapY()

double DXF_IMPORT_PLUGIN::mapY ( double  aDxfCoordY)
private

◆ ocsToWcs()

VECTOR3D DXF_IMPORT_PLUGIN::ocsToWcs ( const MATRIX3x3D arbitraryAxis,
VECTOR3D  point 
)
private

Converts a given object coordinate point to world coordinate using the given arbitrary axis vectors.

Definition at line 1614 of file dxf_import_plugin.cpp.

References wcsToOcs().

Referenced by addArc(), addCircle(), addEllipse(), addInsert(), addMText(), addPoint(), addText(), and addVertex().

◆ ReportMsg()

◆ SetBrdLayer()

void DXF_IMPORT_PLUGIN::SetBrdLayer ( int  aBrdLayer)
inline

Set the layer number to import dxf items.

The layer should be a technical layer, not a copper layer.

Definition at line 300 of file dxf_import_plugin.h.

References m_brdLayer.

◆ SetDefaultLineWidthMM()

void DXF_IMPORT_PLUGIN::SetDefaultLineWidthMM ( double  aWidth)
inline

Set the default line width when importing dxf items like lines to Pcbnew.

DXF files have no line width explicit parameter, it will be most of time the line width of imported lines. f

Parameters
aWidthis the line width in mm.

Definition at line 273 of file dxf_import_plugin.h.

References m_defaultThickness.

Referenced by SetImporter(), and SetLineWidthMM().

◆ SetImporter()

void DXF_IMPORT_PLUGIN::SetImporter ( GRAPHICS_IMPORTER aImporter)
overridevirtual

◆ SetLineWidthMM()

void DXF_IMPORT_PLUGIN::SetLineWidthMM ( double  aWidth)
inlineoverridevirtual

Reimplemented from GRAPHICS_IMPORT_PLUGIN.

Definition at line 278 of file dxf_import_plugin.h.

References SetDefaultLineWidthMM().

◆ SetOffset()

void DXF_IMPORT_PLUGIN::SetOffset ( double  aOffsetX,
double  aOffsetY 
)
inline

Set the coordinate offset between the imported dxf items and Pcbnew.

DXF files have the Y axis from bottom to top aOffsetX = 0, and aOffsetY = - vertical page size to import a full page.

Parameters
aOffsetXis the X offset in mm.
aOffsetYis the Y offset in mm.

Definition at line 289 of file dxf_import_plugin.h.

References m_xOffset, and m_yOffset.

◆ SetUnit()

void DXF_IMPORT_PLUGIN::SetUnit ( DXF_IMPORT_UNITS  aUnit)
inline

Set the default units when importing DXFs.

DXFs can lack units by design which requires the importing software to make the decision.

Parameters
aUnitsis the default unit of the DXF to assume.

Definition at line 260 of file dxf_import_plugin.h.

References m_currentUnit.

◆ setVariableDouble()

virtual void DXF_IMPORT_PLUGIN::setVariableDouble ( const std::string &  key,
double  value,
int  code 
)
inlineoverrideprivatevirtual

Called for every double variable in the DXF file (e.g.

"$DIMEXO").

Definition at line 399 of file dxf_import_plugin.h.

◆ setVariableInt()

void DXF_IMPORT_PLUGIN::setVariableInt ( const std::string &  key,
int  value,
int  code 
)
overrideprivatevirtual

Called for every int variable in the DXF file (e.g.

"$ACADMAINTVER").

Definition at line 1036 of file dxf_import_plugin.cpp.

References m_codePage, m_currentUnit, m_importAnglePrecision, and m_importCoordinatePrecision.

◆ setVariableString()

void DXF_IMPORT_PLUGIN::setVariableString ( const std::string &  key,
const std::string &  value,
int  code 
)
overrideprivatevirtual

Called for every string variable in the DXF file (e.g.

"$ACADVER").

Definition at line 1096 of file dxf_import_plugin.cpp.

◆ toDxfString()

wxString DXF_IMPORT_PLUGIN::toDxfString ( const wxString &  aStr)
staticprivate

Convert a native Unicode string into a DXF encoded string.

DXF encoding includes the following special sequences:

  • %%c for a diameter sign
  • %%d for a degree sign
  • %%p for a plus/minus sign

Definition at line 1103 of file dxf_import_plugin.cpp.

References res.

◆ toNativeString()

wxString DXF_IMPORT_PLUGIN::toNativeString ( const wxString &  aData)
staticprivate

Convert a DXF encoded string into a native Unicode string.

Definition at line 1157 of file dxf_import_plugin.cpp.

References res.

Referenced by addMText(), and addText().

◆ updateImageLimits()

void DXF_IMPORT_PLUGIN::updateImageLimits ( const VECTOR2D aPoint)

◆ wcsToOcs()

VECTOR3D DXF_IMPORT_PLUGIN::wcsToOcs ( const MATRIX3x3D arbitraryAxis,
VECTOR3D  point 
)
private

Converts a given world coordinate point to object coordinate using the given arbitrary axis vectors.

Definition at line 1608 of file dxf_import_plugin.cpp.

Referenced by ocsToWcs().

◆ writeLine()

void DXF_IMPORT_PLUGIN::writeLine ( )
private

◆ writeMtext()

void DXF_IMPORT_PLUGIN::writeMtext ( )
private

Member Data Documentation

◆ m_blocks

std::vector<std::unique_ptr<DXF_IMPORT_BLOCK> > DXF_IMPORT_PLUGIN::m_blocks
private

Definition at line 590 of file dxf_import_plugin.h.

Referenced by addBlock(), getImportBlock(), Load(), and LoadFromMemory().

◆ m_brdLayer

int DXF_IMPORT_PLUGIN::m_brdLayer
private

Definition at line 568 of file dxf_import_plugin.h.

Referenced by DXF_IMPORT_PLUGIN(), and SetBrdLayer().

◆ m_codePage

std::string DXF_IMPORT_PLUGIN::m_codePage
private

Definition at line 570 of file dxf_import_plugin.h.

Referenced by setVariableInt().

◆ m_curr_entity

DXF2BRD_ENTITY_DATA DXF_IMPORT_PLUGIN::m_curr_entity
private

◆ m_currentBlock

◆ m_currentUnit

DXF_IMPORT_UNITS DXF_IMPORT_PLUGIN::m_currentUnit
private

◆ m_defaultThickness

double DXF_IMPORT_PLUGIN::m_defaultThickness
private

◆ m_importAnglePrecision

int DXF_IMPORT_PLUGIN::m_importAnglePrecision
private

Definition at line 584 of file dxf_import_plugin.h.

Referenced by DXF_IMPORT_PLUGIN(), and setVariableInt().

◆ m_importAsFPShapes

bool DXF_IMPORT_PLUGIN::m_importAsFPShapes
private

Definition at line 571 of file dxf_import_plugin.h.

Referenced by DXF_IMPORT_PLUGIN(), and ImportAsFootprintGraphic().

◆ m_importCoordinatePrecision

int DXF_IMPORT_PLUGIN::m_importCoordinatePrecision
private

Definition at line 583 of file dxf_import_plugin.h.

Referenced by DXF_IMPORT_PLUGIN(), and setVariableInt().

◆ m_importer

GRAPHICS_IMPORTER* GRAPHICS_IMPORT_PLUGIN::m_importer
protectedinherited

< Importer used to create objects representing the imported shapes.

Definition at line 138 of file graphics_import_plugin.h.

Referenced by Import(), SVG_IMPORT_PLUGIN::Import(), SVG_IMPORT_PLUGIN::Load(), SVG_IMPORT_PLUGIN::LoadFromMemory(), GRAPHICS_IMPORT_PLUGIN::SetImporter(), and SetImporter().

◆ m_internalImporter

◆ m_layers

std::vector<std::unique_ptr<DXF_IMPORT_LAYER> > DXF_IMPORT_PLUGIN::m_layers
private

◆ m_maxX

double DXF_IMPORT_PLUGIN::m_maxX
private

◆ m_maxY

double DXF_IMPORT_PLUGIN::m_maxY
private

◆ m_messages

wxString DXF_IMPORT_PLUGIN::m_messages
private

Definition at line 573 of file dxf_import_plugin.h.

Referenced by GetMessages(), and ReportMsg().

◆ m_minX

double DXF_IMPORT_PLUGIN::m_minX
private

◆ m_minY

double DXF_IMPORT_PLUGIN::m_minY
private

◆ m_mtextContent

std::string DXF_IMPORT_PLUGIN::m_mtextContent
private

Definition at line 577 of file dxf_import_plugin.h.

Referenced by addMText(), and addMTextChunk().

◆ m_styles

std::vector<std::unique_ptr<DXF_IMPORT_STYLE> > DXF_IMPORT_PLUGIN::m_styles
private

Definition at line 591 of file dxf_import_plugin.h.

Referenced by addTextStyle(), getImportStyle(), Load(), and LoadFromMemory().

◆ m_version

int DXF_IMPORT_PLUGIN::m_version
private

Definition at line 569 of file dxf_import_plugin.h.

Referenced by DXF_IMPORT_PLUGIN().

◆ m_xOffset

double DXF_IMPORT_PLUGIN::m_xOffset
private

Definition at line 565 of file dxf_import_plugin.h.

Referenced by DXF_IMPORT_PLUGIN(), mapX(), and SetOffset().

◆ m_yOffset

double DXF_IMPORT_PLUGIN::m_yOffset
private

Definition at line 566 of file dxf_import_plugin.h.

Referenced by DXF_IMPORT_PLUGIN(), mapY(), and SetOffset().


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