45#define DXF_LINE_WIDTH DO_NOT_SET_LINE_WIDTH
80 {
"LIGHTYELLOW", 51 },
84 {
"LIGHTMAGENTA", 212 },
85 {
"LIGHTORANGE", 30 },
92 {
"DARKMAGENTA", 216 },
101 {
"PUREMAGENTA", 6 },
102 {
"PUREORANGE", 40 },
112 {
"ORANGETHREE", 22 },
113 {
"ORANGEFOUR", 23 },
114 {
"ORANGEFIVE", 24 },
119 {
"ORANGESEVEN", 29 },
120 {
"ORANGEEIGHT", 31 },
121 {
"ORANGENINE", 33 },
123 {
"ORANGEELEVEN", 36 },
124 {
"ORANGETWELVE", 37 },
125 {
"ORANGETHIRTEEN", 38 },
126 {
"ORANGEFOURTEEN", 39 },
129 {
"YELLOWTHREE", 44 },
130 {
"YELLOWFOUR", 45 },
131 {
"YELLOWFIVE", 46 },
133 {
"YELLOWSEVEN", 48 },
134 {
"YELLOWEIGHT", 49 },
135 {
"YELLOWNINE", 53 },
137 {
"YELLOWELEVEN", 58 },
138 {
"YELLOWTWELVE", 59 },
139 {
"YELLOWTHIRTEEN", 60 },
140 {
"YELLOWFOURTEEN", 61 },
143 {
"GREENTHREE", 64 },
147 {
"GREENSEVEN", 68 },
148 {
"GREENEIGHT", 69 },
151 {
"GREENELEVEN", 72 },
152 {
"GREENTWELVE", 73 },
153 {
"GREENTHIRTEEN", 74 },
154 {
"GREENFOURTEEN", 75 },
155 {
"GREENFIFTEEN", 76 },
156 {
"GREENSIXTEEN", 77 },
157 {
"GREENSEVENTEEN", 78 },
158 {
"GREENEIGHTEEN", 79 },
159 {
"GREENNINETEEN", 80 },
160 {
"GREENTWENTY", 81 },
161 {
"GREENTWENTYONE", 82 },
162 {
"GREENTWENTYTWO", 83 },
163 {
"GREENTWENTYTHREE", 84 },
164 {
"GREENTWENTYFOUR", 85 },
165 {
"GREENTWENTYFIVE", 86 },
166 {
"GREENTWENTYSIX", 87 },
167 {
"GREENTWENTYSEVEN", 88 },
168 {
"GREENTWENTYEIGHT", 89 },
169 {
"GREENTWENTYNINE", 90 },
170 {
"GREENTHIRTY", 91 },
171 {
"GREENTHIRTYONE", 93 },
172 {
"GREENTHIRTYTWO", 95 },
173 {
"GREENTHIRTYTHREE", 97 },
174 {
"GREENTHIRTYFOUR", 98 },
175 {
"GREENTHIRTYFIVE", 99 },
176 {
"GREENTHIRTYSIX", 100 },
177 {
"GREENTHIRTYSEVEN", 101 },
178 {
"GREENTHIRTYEIGHT", 102 },
179 {
"GREENTHIRTYNINE", 103 },
180 {
"GREENFORTY", 104 },
181 {
"GREENFORTYONE", 105 },
182 {
"GREENFORTYTWO", 106 },
183 {
"GREENFORTYTHREE", 107 },
184 {
"GREENFORTYFOUR", 108 },
185 {
"GREENFORTYFIVE", 109 },
186 {
"GREENFORTYSIX", 110 },
187 {
"GREENFORTYSEVEN", 111 },
188 {
"GREENFORTYEIGHT", 112 },
189 {
"GREENFORTYNINE", 113 },
190 {
"GREENFIFTY", 114 },
191 {
"GREENFIFTYONE", 115 },
192 {
"GREENFIFTYTWO", 116 },
193 {
"GREENFIFTYTHREE", 117 },
194 {
"GREENFIFTYFOUR", 118 },
195 {
"GREENFIFTYFIVE", 119 },
196 {
"GREENFIFTYSIX", 120 },
197 {
"GREENFIFTYSEVEN", 121 },
198 {
"GREENFIFTYEIGHT", 122 },
199 {
"GREENFIFTYNINE", 123 },
200 {
"GREENSIXTY", 124 },
201 {
"GREENSIXTYONE", 125 },
202 {
"GREENSIXTYTWO", 126 },
203 {
"GREENSIXTYTHREE", 127 },
204 {
"GREENSIXTYFOUR", 128 },
205 {
"GREENSIXTYFIVE", 129 },
208 {
"CYANTHREE", 135 },
212 {
"CYANSEVEN", 140 },
215 {
"BLUETHREE", 143 },
219 {
"BLUESEVEN", 147 },
220 {
"BLUEEIGHT", 148 },
223 {
"BLUEELEVEN", 151 },
224 {
"BLUETWELVE", 152 },
225 {
"BLUETHIRTEEN", 153 },
226 {
"BLUEFOURTEEN", 154 },
227 {
"BLUEFIFTEEN", 155 },
228 {
"BLUESIXTEEN", 156 },
229 {
"BLUESEVENTEEN", 157 },
230 {
"BLUEEIGHTEEN", 158 },
231 {
"BLUENINETEEN", 159 },
232 {
"BLUETWENTY", 160 },
233 {
"BLUETWENTYONE", 161 },
234 {
"BLUETWENTYTWO", 162 },
235 {
"BLUETWENTYTHREE", 163 },
236 {
"BLUETWENTYFOUR", 164 },
237 {
"BLUETWENTYFIVE", 165 },
238 {
"BLUETWENTYSIX", 166 },
239 {
"BLUETWENTYSEVEN", 167 },
240 {
"BLUETWENTYEIGHT", 168 },
241 {
"BLUETWENTYNINE", 169 },
242 {
"BLUETHIRTY", 170 },
243 {
"BLUETHIRTYONE", 171 },
244 {
"BLUETHIRTYTWO", 177 },
245 {
"BLUETHIRTYETHREE", 178 },
246 {
"BLUETHIRTYFOUR", 179 },
247 {
"VIOLETONE", 180 },
248 {
"VIOLETTWO", 181 },
249 {
"VIOLETTHREE", 182 },
250 {
"VIOLETFOUR", 183 },
251 {
"VIOLETFIVE", 184 },
252 {
"VIOLETSIX", 185 },
253 {
"VIOLETSEVEN", 186 },
254 {
"VIOLETEIGHT", 187 },
255 {
"VIOLETNINE", 188 },
256 {
"VIOLETTEN", 189 },
257 {
"VIOLETELEVEN", 190 },
258 {
"VIOLETTWELVE", 191 },
259 {
"VIOLETTHIRTEEN", 192 },
260 {
"VIOLETFOURTEEN", 193 },
261 {
"VIOLETFIFTEEN", 194 },
262 {
"VIOLETSIXTEEN", 195 },
263 {
"VIOLETSEVENTEEN", 196 },
264 {
"VIOLETEIGHTEEN", 197 },
265 {
"VIOLETNINETEEN", 198 },
266 {
"VIOLETTWENTY", 199 },
267 {
"VIOLETTWENTYONE", 200 },
268 {
"VIOLETTWENTYTWO", 201 },
269 {
"VIOLETTWENTYTHREE", 202 },
270 {
"VIOLETTWENTYFOUR", 203 },
271 {
"VIOLETTWENTYFIVE", 204 },
272 {
"VIOLETTWENTYSIX", 205 },
273 {
"VIOLETTWENTYSEVEN", 206 },
274 {
"VIOLETTWENTYEIGHT", 207 },
275 {
"VIOLETTWENTYNINE", 208 },
276 {
"VIOLETTHIRTY", 209 },
277 {
"MAGENTAONE", 210 },
278 {
"MAGENTATWO", 211 },
279 {
"MAGENTATHREE", 213 },
280 {
"MAGENTAFOUR", 215 },
281 {
"MAGENTAFIVE", 217 },
282 {
"MAGENTASIX", 218 },
283 {
"MAGENTASEVEN", 219 },
284 {
"MAGENTAEIGHT", 220 },
285 {
"MAGENTANINE", 221 },
286 {
"MAGENTATEN", 222 },
287 {
"MAGENTAELEVEN", 223 },
288 {
"MAGENTATWELVE", 224 },
289 {
"MAGENTATHIRTEEN", 225 },
290 {
"MAGENTAFOURTEEN", 226 },
292 {
"REDELEVEN", 228 },
293 {
"VIOLETFIFTEEN", 229 },
294 {
"REDTWELVE", 230 },
295 {
"REDTHIRTEEN", 231 },
296 {
"REDFOURTEEN", 232 },
297 {
"REDFIFTEEN", 233 },
298 {
"REDSIXTEEN", 234 },
299 {
"REDSEVENTEEN", 235 },
300 {
"REDEIGHTEEN", 236 },
301 {
"REDNINETEEN", 237 },
302 {
"REDTWENTY", 238 },
303 {
"REDTWENTYONE", 239 },
304 {
"REDTWENTYTWO", 240 },
305 {
"REDTWENTYTHREE", 241 },
306 {
"REDTWENTYFOUR", 242 },
307 {
"REDTWENTYFIVE", 243 },
308 {
"REDTWENTYSIX", 244 },
309 {
"REDTWENTYSEVEN", 245 },
310 {
"REDTWENTYEIGHT", 246 },
311 {
"REDTWENTYNINE", 247 },
312 {
"REDTHIRTY", 248 },
313 {
"REDTHIRTYONE", 249 },
316 {
"GRAYTHREE", 253 },
596 wxFAIL_MSG(
"Unhandled LINE_STYLE" );
605 int nearestDistance = std::numeric_limits<int>::max();
610 int distance = ( aR - c.red ) * ( aR - c.red ) + ( aG - c.green ) * ( aG - c.green )
611 + ( aB - c.blue ) * ( aB - c.blue );
616 nearestColorValueIndex = trying;
620 return nearestColorValueIndex;
664 int( layerColor.
r * 255 ),
int( layerColor.
g * 255 ),
int( layerColor.
b * 255 ) );
669 [actualLayerId](
const std::pair<int, wxString>& element )
671 return element.first == actualLayerId;
685 int( layerColor.
r * 255 ),
int( layerColor.
g * 255 ),
int( layerColor.
b * 255 ) );
690 default:
return wxString(
"Unknown Mode" );
724 buf = fmt::format(
"{:.16f}", aValue );
727 while( !buf.empty() && buf[buf.size() - 1] ==
'0' )
737 double aScale,
bool aMirror )
762 return fmt::format(
"{:X}", ++
m_handle );
767 const std::string& aLayerName,
768 const std::string& aOwner )
779 aEntityType, handle, owner, aLayerName );
798 "100\nAcDbSymbolTable\n"
800 aTableName, handle, aCount );
864 "100\nAcDbSymbolTableRecord\n"
865 "100\nAcDbRegAppTableRecord\n"
879 const char* description;
881 double patternLength;
888 static const LtypePattern ltypes[] = {
889 {
"ByBlock",
"", 0, 0.0,
"" },
890 {
"ByLayer",
"", 0, 0.0,
"" },
891 {
"CONTINUOUS",
"Solid line", 0, 0.0,
"" },
892 {
"DASHDOT",
"Dash Dot ____ _ ____ _", 4, 2.0,
" 49\n1.25\n 74\n0\n 49\n-0.25\n 74\n0\n"
893 " 49\n0.25\n 74\n0\n 49\n-0.25\n 74\n0\n" },
894 {
"DASHED",
"Dashed __ __ __ __ __", 2, 0.75,
" 49\n0.5\n 74\n0\n 49\n-0.25\n 74\n0\n" },
895 {
"DOTTED",
"Dotted . . . .", 2, 0.2,
" 49\n0.0\n 74\n0\n 49\n-0.2\n 74\n0\n" },
899 static_cast<int>( std::size( ltypes ) ) );
901 for(
const LtypePattern& lt : ltypes )
908 "100\nAcDbSymbolTableRecord\n"
909 "100\nAcDbLinetypeTableRecord\n"
918 lt.name, lt.description, lt.elementCount, lt.patternLength, lt.dashes );
928 static const char* style_name[4] = {
"KICAD",
"KICADB",
"KICADI",
"KICADBI" };
930 for(
int i = 0; i < 4; i++ )
937 "100\nAcDbSymbolTableRecord\n"
938 "100\nAcDbTextStyleTableRecord\n"
982 "100\nAcDbSymbolTableRecord\n"
983 "100\nAcDbLayerTableRecord\n"
1001 bool hasActualColor =
false;
1004 for(
int i = 0; i < numLayers; i++ )
1012 [colorName](
const auto& layer)
1014 return std::strcmp( layer.name, colorName.ToStdString().c_str() ) == 0;
1023 hasActualColor =
true;
1036 "100\nAcDbSymbolTableRecord\n"
1037 "100\nAcDbLayerTableRecord\n"
1044 if( hasActualColor )
1048 int r =
static_cast<int>( actualColor.
r * 255 );
1049 int g =
static_cast<int>( actualColor.
g * 255 );
1050 int b =
static_cast<int>( actualColor.
b * 255 );
1052 int trueColorValue = ( r << 16 ) | ( g << 8 ) | b;
1054 fmt::print(
m_outputFile,
"420\n{}\n", trueColorValue );
1071 for(
const char* tableName : {
"VPORT",
"VIEW",
"UCS" } )
1083 "100\nAcDbDimStyleTable\n"
1089 "100\nAcDbSymbolTableRecord\n"
1090 "100\nAcDbDimStyleTableRecord\n"
1125 "100\nAcDbSymbolTableRecord\n"
1126 "100\nAcDbBlockTableRecord\n"
1132 l.blockRecordHandle, blockRecordTableHandle, l.blockName, l.layoutHandle );
1159 "100\nAcDbBlockBegin\n"
1162 " 10\n0.0\n 20\n0.0\n 30\n0.0\n"
1172 "100\nAcDbBlockEnd\n",
1174 l.isPaperSpace ?
" 67\n1\n" :
"",
1175 l.blockName, l.blockName,
1177 l.isPaperSpace ?
" 67\n1\n" :
"" );
1201 std::string acadGroupDictHandle =
nextHandle();
1212 "100\nAcDbDictionary\n"
1218 " 3\nACAD_PLOTSTYLENAME\n"
1229 "100\nAcDbDictionary\n"
1238 "ACDBDICTIONARYWDFLT\n"
1241 "100\nAcDbDictionary\n"
1245 "100\nAcDbDictionaryWithDefault\n"
1265 "100\nAcDbDictionary\n"
1274 l.name, l.layoutHandle );
1280 static constexpr const char* PAPER_NAME =
"A3";
1281 static constexpr double PAPER_WIDTH_MM = 420.0;
1282 static constexpr double PAPER_HEIGHT_MM = 297.0;
1283 static constexpr int PLOT_FLAG_MODELTYPE = 1024;
1291 int plotLayoutFlag = l.
isPaperSpace ? 0 : PLOT_FLAG_MODELTYPE;
1298 "100\nAcDbPlotSettings\n"
1303 " 40\n0.0\n 41\n0.0\n 42\n0.0\n 43\n0.0\n"
1304 " 44\n{:.1f}\n 45\n{:.1f}\n 46\n0.0\n 47\n0.0\n"
1305 " 48\n0.0\n 49\n0.0\n"
1306 "140\n0.0\n141\n0.0\n142\n1.0\n143\n1.0\n"
1308 " 72\n1\n 73\n0\n 74\n5\n"
1311 " 76\n0\n 77\n2\n 78\n300\n"
1313 "148\n0.0\n149\n0.0\n"
1318 " 10\n0.0\n 20\n0.0\n"
1319 " 11\n{:.1f}\n 21\n{:.1f}\n"
1320 " 12\n0.0\n 22\n0.0\n 32\n0.0\n"
1321 " 14\n1e+20\n 24\n1e+20\n 34\n1e+20\n"
1322 " 15\n-1e+20\n 25\n-1e+20\n 35\n-1e+20\n"
1324 " 13\n0.0\n 23\n0.0\n 33\n0.0\n"
1325 " 16\n1.0\n 26\n0.0\n 36\n0.0\n"
1326 " 17\n0.0\n 27\n1.0\n 37\n0.0\n"
1330 PAPER_NAME, PAPER_WIDTH_MM, PAPER_HEIGHT_MM,
1332 l.
name,
static_cast<int>( i ),
1333 PAPER_WIDTH_MM, PAPER_HEIGHT_MM,
1383 if( aCornerRadius > 0 )
1409 fmt::print(
m_outputFile,
" 10\n{}\n 20\n{}\n 30\n0\n",
1424 std::string layer =
TO_UTF8( cLayerName );
1431 fmt::print(
m_outputFile,
" 10\n{}\n 20\n{}\n 30\n0\n 40\n{}\n",
1443 std::string polyHandle =
emitEntityHandle(
"POLYLINE",
"AcDb2dPolyline", layer );
1448 " 10\n0\n 20\n0\n 30\n0\n"
1449 " 70\n1\n 40\n{}\n 41\n{}\n",
1452 for(
double offset : { -r, r } )
1456 "100\nAcDb2dVertex\n"
1457 " 10\n{}\n 20\n{}\n 30\n0\n 42\n1.0\n",
1469 fmt::print(
m_outputFile,
" 10\n{}\n 20\n{}\n 30\n0\n",
1479 if( aCornerList.size() <= 1 )
1482 unsigned last = aCornerList.size() - 1;
1487 MoveTo( aCornerList[0] );
1489 for(
unsigned ii = 1; ii < aCornerList.size(); ii++ )
1490 LineTo( aCornerList[ii] );
1495 if( aCornerList[last] != aCornerList[0] )
1496 LineTo( aCornerList[0] );
1512 for(
unsigned ii = 1; ii < aCornerList.size(); ii++ )
1519 for(
const VECTOR2I& corner : aCornerList )
1520 bufferPolybase.
Append( corner );
1534 if(
path.PointCount() < 2 )
1538 last =
path.PointCount() - 1;
1544 for(
int ii = 1; ii <
path.PointCount(); ii++ )
1546 point =
path.CPoint( ii );
1551 point =
path.CPoint( last );
1554 if( endPoint != startPoint )
1562 const EDA_ANGLE& aAngle,
double aRadius )
1564 std::vector<VECTOR2I> pts;
1571 EDA_ANGLE endAngle = startAngle - aAngle;
1576 if( startAngle > endAngle )
1577 std::swap( startAngle, endAngle );
1580 start.
x =
KiROUND( aCenter.
x + aRadius * ( -startAngle ).Cos() );
1581 start.
y =
KiROUND( aCenter.
y + aRadius * ( -startAngle ).Sin() );
1582 pts.emplace_back( start );
1586 end.x =
KiROUND( aCenter.
x + aRadius * ( -ii ).Cos() );
1587 end.y =
KiROUND( aCenter.
y + aRadius * ( -ii ).Sin() );
1588 pts.emplace_back(
end );
1591 end.x =
KiROUND( aCenter.
x + aRadius * ( -endAngle ).Cos() );
1592 end.y =
KiROUND( aCenter.
y + aRadius * ( -endAngle ).Sin() );
1593 pts.emplace_back(
end );
1601 std::set<size_t> handledArcs;
1602 std::vector<VECTOR2I> cornerList;
1604 for(
int ii = 0; ii < aLineChain.
SegmentCount(); ++ii )
1608 size_t arcIndex = aLineChain.
ArcIndex( ii );
1610 if( !handledArcs.contains( arcIndex ) )
1612 handledArcs.insert( arcIndex );
1617 for(
const VECTOR2I& pt : std::ranges::reverse_view( pts ) )
1618 cornerList.emplace_back( pt );
1624 cornerList.emplace_back( seg.
A );
1625 cornerList.emplace_back( seg.
B );
1629 if( aLineChain.
IsClosed() && cornerList.front() != cornerList.back() )
1630 cornerList.emplace_back( aLineChain.
CPoint( 0 ) );
1632 PlotPoly( cornerList, aFill, aWidth, aData );
1655 std::string layer =
TO_UTF8( cLayerName );
1668 " 10\n{}\n 20\n{}\n 30\n0\n 11\n{}\n 21\n{}\n 31\n0\n",
1698 EDA_ANGLE endAngle = startAngle - aAngle;
1702 if( endAngle < startAngle )
1703 std::swap( startAngle, endAngle );
1711 std::string layer =
TO_UTF8( cLayerName );
1715 " 10\n{}\n 20\n{}\n 30\n0\n 40\n{}\n"
1717 " 50\n{:.8f}\n 51\n{:.8f}\n",
1732 std::vector<VECTOR2I> cornerList;
1738 cornerList.reserve(
path.PointCount() );
1740 for(
int jj = 0; jj <
path.PointCount(); jj++ )
1741 cornerList.emplace_back(
path.CPoint( jj ).x,
path.CPoint( jj ).y );
1744 if( cornerList[0] != cornerList[cornerList.size() - 1] )
1745 cornerList.push_back( cornerList[0] );
1758 const EDA_ANGLE& aAngle,
double aRadius,
int aWidth,
void* aData )
1780 VECTOR2I offsetp1( p1.
x - width/2, p1.
y - width/2 );
1781 VECTOR2I offsetp2( p2.
x + width/2, p2.
y + width/2 );
1784 offsetp1.
x += width;
1785 offsetp1.
y += width;
1786 offsetp2.
x -= width;
1787 offsetp2.
y -= width;
1855 if( size.
x > size.
y )
1857 std::swap( size.
x, size.
y );
1879 size.
x = aPadSize.
x / 2;
1880 size.
y = aPadSize.
y / 2;
1932 int aCornerRadius,
const EDA_ANGLE& aOrient,
void* aData )
1943 for(
int ii = 1; ii < poly.
PointCount(); ++ii )
1954 for(
int cnt = 0; cnt < aPolygons->
OutlineCount(); ++cnt )
1960 for(
int ii = 1; ii < poly.
PointCount(); ++ii )
1969 const EDA_ANGLE& aPadOrient,
void* aData )
1974 for(
int ii = 0; ii < 4; ii++ )
1976 coord[ii] = aCorners[ii];
1978 coord[ii] += aPadPos;
2007 for(
unsigned i = 0; i <
string.length(); i++ )
2009 wchar_t ch =
string[i];
2020 const wxString& aText,
2028 bool aMultilineAllowed,
2034 if( aMultilineAllowed && !aText.Contains( wxT(
"\n" ) ) )
2035 aMultilineAllowed =
false;
2037 bool processSuperSub = aText.Contains( wxT(
"^{" ) ) || aText.Contains( wxT(
"_{" ) );
2044 PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
2045 aBold, aMultilineAllowed, aFont, aFontMetrics, aData );
2065 const wxString& aText,
2074 if( attrs.
m_Multiline && !aText.Contains( wxT(
"\n" ) ) )
2077 bool processSuperSub = aText.Contains( wxT(
"^{" ) ) || aText.Contains( wxT(
"_{" ) );
2084 PLOTTER::PlotText( aPos, aColor, aText, aAttributes, aFont, aFontMetrics, aData );
2103 int h_code = 0, v_code = 0;
2121 std::string textStyle =
"KICAD";
2125 textStyle =
"KICADBI";
2127 textStyle =
"KICADB";
2130 textStyle =
"KICADI";
2138 " 10\n{}\n 20\n{}\n 30\n0\n"
2166 int braceNesting = 0;
2167 int overbarDepth = -1;
2171 for(
unsigned int i = 0; i < aText.length(); i++ )
2179 wchar_t ch = aText[i];
2188 if( aText[i] ==
'~' && i+1 < aText.length() && aText[i+1] ==
'{' )
2191 overbarDepth = braceNesting;
2197 else if( aText[i] ==
'{' )
2201 else if( aText[i] ==
'}' )
2203 if( braceNesting > 0 )
2206 if( braceNesting == overbarDepth )
2228 " 11\n{}\n 21\n{}\n 31\n0\n"
static const double DXF_OBLIQUE_ANGLE
Oblique angle for DXF native text (I don't remember if 15 degrees is the ISO value....
static std::string formatCoord(double aValue)
bool containsNonAsciiChars(const wxString &string)
Check if a given string contains non-ASCII characters.
std::vector< VECTOR2I > arcPts(const VECTOR2D &aCenter, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle, double aRadius)
static const struct @110355335012326036072316124131344246226335322120 acad_dxf_color_names[]
The layer/colors palette.
static const char * getDXFLineType(LINE_STYLE aType)
static const struct @021340374267035355154031176330133165301272264217 acad_dxf_color_values[]
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
static const COLOR4D WHITE
static const COLOR4D BLACK
void plotOneLineOfText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttrs)
unsigned int GetInsUnits() const
Get the correct value for the $INSUNITS header variable given the current units.
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics, void *aData=nullptr) override
virtual void FlashPadCustom(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, SHAPE_POLY_SET *aPolygons, void *aData) override
virtual void ThickCircle(const VECTOR2I &pos, int diametre, int width, void *aData) override
std::string m_layoutDictHandle
void SetUnits(DXF_UNITS aUnit)
Set the units to use for plotting the DXF file.
std::vector< DxfLayout > m_dxfLayouts
virtual void SetViewport(const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the scale/position for the DXF plot.
virtual void ThickArc(const VECTOR2D &aCentre, const EDA_ANGLE &aStAngle, const EDA_ANGLE &aAngle, double aRadius, int aWidth, void *aData) override
virtual void Arc(const VECTOR2D &aCenter, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle, double aRadius, FILL_T aFill, int aWidth) override
double GetUnitScaling() const
Get the scale factor to apply to convert the device units to be in the currently set units.
virtual void FlashPadOval(const VECTOR2I &aPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, void *aData) override
DXF oval pad: always done in sketch mode.
std::string emitEntityHandle(const char *aEntityType, const char *aSubclass, const std::string &aLayerName, const std::string &aOwner="")
std::string m_plotStyleNameDictHandle
virtual void FlashPadRect(const VECTOR2I &aPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, void *aData) override
DXF rectangular pad: always done in sketch mode.
virtual void ThickRect(const VECTOR2I &p1, const VECTOR2I &p2, int width, void *aData) override
virtual void FlashPadRoundRect(const VECTOR2I &aPadPos, const VECTOR2I &aSize, int aCornerRadius, const EDA_ANGLE &aOrient, void *aData) override
virtual void ThickPoly(const SHAPE_POLY_SET &aPoly, int aWidth, void *aData) override
virtual bool StartPlot(const wxString &aPageNumber) override
Open the DXF plot with a skeleton header.
unsigned int GetMeasurementDirective() const
Get the correct value for the $MEASUREMENT field given the current units.
virtual void FlashPadTrapez(const VECTOR2I &aPadPos, const VECTOR2I *aCorners, const EDA_ANGLE &aPadOrient, void *aData) override
DXF trapezoidal pad: only sketch mode is supported.
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width) override
DXF circle: full functionality; it even does 'fills' drawing a circle with a dual-arc polyline wide a...
virtual void FlashPadCircle(const VECTOR2I &pos, int diametre, void *aData) override
DXF round pad: always done in sketch mode; it could be filled but it isn't pretty if other kinds of p...
virtual void FilledCircle(const VECTOR2I &pos, int diametre, void *aData) override
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth, void *aData=nullptr) override
DXF polygon: doesn't fill it but at least it close the filled ones DXF does not know thick outline.
std::string m_modelSpaceHandle
wxString GetCurrentLayerName(DXF_LAYER_OUTPUT_MODE aMode, std::optional< PCB_LAYER_ID > aLayerId=std::nullopt)
Retrieves the current layer name or layer color name for DXF plotting.
std::string emitSymbolTableHeader(const char *aTableName, int aCount)
std::string m_namedObjectDictHandle
void writeObjectsSection()
unsigned int m_measurementDirective
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width, int aCornerRadius=0) override
DXF rectangle: fill not supported.
virtual bool EndPlot() override
virtual void FlashRegularPolygon(const VECTOR2I &aShapePos, int aDiameter, int aCornerCount, const EDA_ANGLE &aOrient, void *aData) override
Flash a regular polygon.
virtual void PenTo(const VECTOR2I &pos, char plume) override
Moveto/lineto primitive, moves the 'pen' to the specified direction.
virtual void SetColor(const COLOR4D &color) override
The DXF exporter handles 'colors' as layers...
int FindNearestLegacyColor(int aR, int aG, int aB)
virtual void Text(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics, void *aData=nullptr) override
Draw text with the plotter.
virtual void ThickSegment(const VECTOR2I &start, const VECTOR2I &end, int width, void *aData) override
std::string m_plotStyleNormalHandle
double m_unitScalingFactor
virtual void SetDash(int aLineWidth, LINE_STYLE aLineStyle) override
LINE_STYLE m_currentLineType
FONT is an abstract base class for both outline and stroke fonts.
A color representation with 4 components: red, green, blue, alpha.
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
PCB_LAYER_ID GetLayer() const
Gets the ID of the current layer.
std::vector< std::pair< PCB_LAYER_ID, wxString > > m_layersToExport
void MoveTo(const VECTOR2I &pos)
virtual void ThickOval(const VECTOR2I &aPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, int aWidth, void *aData)
void FinishTo(const VECTOR2I &pos)
RENDER_SETTINGS * RenderSettings()
virtual VECTOR2D userToDeviceCoordinates(const VECTOR2I &aCoordinate)
Modify coordinates according to the orientation, scale factor, and offsets trace.
virtual VECTOR2D userToDeviceSize(const VECTOR2I &size)
Modify size according to the plotter scale factors (VECTOR2I version, returns a VECTOR2D).
int GetPlotterArcHighDef() const
double m_plotScale
Plot scale - chosen by the user (even implicitly with 'fit in a4')
bool GetColorMode() const
FILE * m_outputFile
Output file.
void LineTo(const VECTOR2I &pos)
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont=nullptr, const KIFONT::METRICS &aFontMetrics=KIFONT::METRICS::Default(), void *aData=nullptr)
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth, void *aData)=0
Draw a polygon ( filled or not ).
virtual void Text(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aPenWidth, bool aItalic, bool aBold, bool aMultilineAllowed, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics, void *aData=nullptr)
Draw text with the plotter.
virtual DXF_OUTLINE_MODE GetDXFPlotMode() const
EDA_ANGLE GetCentralAngle() const
Get the "central angle" of the arc - this is the angle at the point of the "pie slice".
EDA_ANGLE GetStartAngle() const
const VECTOR2I & GetCenter() const
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
const SHAPE_ARC & Arc(size_t aArc) const
bool IsClosed() const override
int PointCount() const
Return the number of points (vertices) in this line chain.
ssize_t ArcIndex(size_t aSegment) const
Return the arc index for the given segment index.
SEG Segment(int aIndex) const
Return a copy of the aIndex-th segment in the line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
int SegmentCount() const
Return the number of segments in this line chain.
bool IsArcSegment(size_t aSegment) const
Represent a set of closed polygons.
void BooleanAdd(const SHAPE_POLY_SET &b)
Perform boolean polyset union.
void Inflate(int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError, bool aSimplify=false)
Perform outline inflation/deflation.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
int NewOutline()
Creates a new empty polygon in the set and returns its index.
void Deflate(int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError)
int OutlineCount() const
Return the number of outlines in the set.
void Fracture(bool aSimplify=true)
Convert a set of polygons with holes to a single outline with "slits"/"fractures" connecting the oute...
SHAPE_POLY_SET CloneDropTriangulation() const
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
const SHAPE_LINE_CHAIN Outline() const
void SetRadius(int aRadius)
GR_TEXT_H_ALIGN_T m_Halign
GR_TEXT_V_ALIGN_T m_Valign
void TransformRoundChamferedRectToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aPosition, const VECTOR2I &aSize, const EDA_ANGLE &aRotation, int aCornerRadius, double aChamferRatio, int aChamferCorners, int aInflate, int aError, ERROR_LOC aErrorLoc)
Convert a rectangle with rounded corners and/or chamfered corners to a polygon.
void TransformOvalToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a oblong shape to a polygon, using multiple segments.
@ ROUND_ALL_CORNERS
All angles are rounded.
static constexpr EDA_ANGLE ANGLE_90
@ FILLED_SHAPE
Fill with object color.
PCB_LAYER_ID
A quick note on layer IDs:
This file contains miscellaneous commonly used macros and functions.
DXF_LAYER_OUTPUT_MODE
Specifies the output mode for the DXF layer.
@ Current_Layer_Color_Name
DXF_COLOR_T
Legacy colors for DXF file.
@ NBCOLORS
Number of colors.
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
LINE_STYLE
Dashed line types.
std::string blockRecordHandle
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
@ GR_TEXT_H_ALIGN_INDETERMINATE
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.
@ GR_TEXT_V_ALIGN_INDETERMINATE
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D