30#include <wx/filename.h>
62 if( opA->
size() == 0 )
65 std::list<IDF_SEGMENT*>::iterator olAs = opA->
begin();
66 std::list<IDF_SEGMENT*>::iterator olAe = opA->
end();
67 std::list<IDF_SEGMENT*>::iterator olBs = opB->
begin();
71 if( !(*olAs)->MatchesStart( (*olBs)->startPoint ) )
74 if( !(*olAs)->MatchesEnd( (*olBs)->endPoint ) )
113 double aXoff,
double aYoff,
114 double aZoff,
double aAngleOff )
132#ifndef DISABLE_IDF_OWNERSHIP
138 ostr << __FILE__ <<
":" << aSourceLine <<
":" << aSourceFunc <<
"():\n";
139 ostr <<
"* BUG: IDF3_COMP_OUTLINE_DATA::parent not set; cannot enforce ownership rules\n";
160 ostr <<
"* " << __FILE__ <<
":" << aSourceLine <<
":" << aSourceFunc <<
"():\n";
161 ostr <<
"* ownership violation; CAD type is ";
179 double aZoff,
double aAngleOff )
181#ifndef DISABLE_IDF_OWNERSHIP
195 double& aZoff,
double& aAngleOff )
212#ifndef DISABLE_IDF_OWNERSHIP
230 IDF_VERSION aIdfVersion,
bool aNoSubstituteOutlines )
233 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
234 "\n* BUG: invoked with no reference to the parent IDF_BOARD" ) );
252 while( !
FetchIDFLine( aBoardFile, iline, isComment, pos ) && aBoardFile.good() );
254 if( ( !aBoardFile.good() && !aBoardFile.eof() ) || iline.empty() )
258 ostr <<
"invalid IDF file\n";
259 ostr <<
"* violation: could not read PLACEMENT section\n";
260 ostr <<
"* file position: " << pos;
262 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
269 ostr <<
"invalid IDF file\n";
270 ostr <<
"* violation: comment within PLACEMENT section\n";
271 ostr <<
"* line: '" << iline <<
"'\n";
272 ostr <<
"* file position: " << pos;
274 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
280 if( !quoted &&
CompareToken(
".END_PLACEMENT", token ) )
286 std::string ngeom = token;
292 ostr <<
"invalid IDF file\n";
293 ostr <<
"* violation: no PART NAME in PLACEMENT RECORD2\n";
294 ostr <<
"* line: '" << iline <<
"'\n";
295 ostr <<
"* file position: " << pos;
297 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
300 std::string npart = token;
301 uid = ngeom +
"_" + npart;
307 ostr <<
"invalid IDF file\n";
308 ostr <<
"* violation: no REFDES in PLACEMENT RECORD2\n";
309 ostr <<
"* line: '" << iline <<
"'\n";
310 ostr <<
"* file position: " << pos;
312 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
330 ostr <<
"UNSUPPORTED FEATURE\n";
331 ostr <<
"* RefDes is 'BOARD', indicating this is a PANEL FILE (not supported)\n";
332 ostr <<
"* line: '" << iline <<
"'\n";
333 ostr <<
"* file position: " << pos;
335 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
341 ostr <<
"invalid IDF file\n";
342 ostr <<
"* violation: RefDes in PLACEMENT RECORD2 is 'PANEL'\n";
343 ostr <<
"* line: '" << iline <<
"'\n";
344 ostr <<
"* file position: " << pos;
346 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
348 else if( token.empty() )
352 ostr <<
"invalid IDF file\n";
353 ostr <<
"* violation: empty RefDes string in PLACEMENT RECORD2\n";
354 ostr <<
"* line: '" << iline <<
"'\n";
355 ostr <<
"* file position: " << pos;
357 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
367 while( !
FetchIDFLine( aBoardFile, iline, isComment, pos ) && aBoardFile.good() );
369 if( !aBoardFile.good() )
373 ostr <<
"invalid IDF file\n";
374 ostr <<
"* problems reading PLACEMENT SECTION, RECORD 3\n";
375 ostr <<
"* file position: " << pos;
377 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
384 ostr <<
"invalid IDF file\n";
385 ostr <<
"* violation: comment within PLACEMENT section\n";
386 ostr <<
"* line: '" << iline <<
"'\n";
387 ostr <<
"* file position: " << pos;
389 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
399 ostr <<
"invalid IDF file\n";
400 ostr <<
"* violation: X value must not be in quotes (PLACEMENT RECORD 3)\n";
401 ostr <<
"* line: '" << iline <<
"'\n";
402 ostr <<
"* file position: " << pos;
404 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
415 ostr <<
"invalid IDF file\n";
416 ostr <<
"* violation: X value is not numeric (PLACEMENT RECORD 3)\n";
417 ostr <<
"* line: '" << iline <<
"'\n";
418 ostr <<
"* file position: " << pos;
420 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
427 ostr <<
"invalid IDF file\n";
428 ostr <<
"* violation: no Y value (PLACEMENT RECORD 3)\n";
429 ostr <<
"* line: '" << iline <<
"'\n";
430 ostr <<
"* file position: " << pos;
432 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
443 ostr <<
"invalid IDF file\n";
444 ostr <<
"* violation: Y value is not numeric (PLACEMENT RECORD 3)\n";
445 ostr <<
"* line: '" << iline <<
"'\n";
446 ostr <<
"* file position: " << pos;
448 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
457 ostr <<
"invalid IDFv3 file\n";
458 ostr <<
"* violation: no Z value (PLACEMENT RECORD 3)\n";
459 ostr <<
"* line: '" << iline <<
"'\n";
460 ostr <<
"* file position: " << pos;
462 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
473 ostr <<
"invalid IDFv3 file\n";
474 ostr <<
"* violation: Z value is not numeric (PLACEMENT RECORD 3)\n";
475 ostr <<
"* line: '" << iline <<
"'\n";
476 ostr <<
"* file position: " << pos;
478 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
486 ostr <<
"invalid IDF file\n";
487 ostr <<
"* violation: no rotation value (PLACEMENT RECORD 3)\n";
488 ostr <<
"* line: '" << iline <<
"'\n";
489 ostr <<
"* file position: " << pos;
491 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
502 ostr <<
"invalid IDF file\n";
503 ostr <<
"* violation: rotation value is not numeric (PLACEMENT RECORD 3)\n";
504 ostr <<
"* line: '" << iline <<
"'\n";
505 ostr <<
"* file position: " << pos;
507 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
514 ostr <<
"invalid IDF file\n";
515 ostr <<
"* violation: no SIDE value (PLACEMENT RECORD 3)\n";
516 ostr <<
"* line: '" << iline <<
"'\n";
517 ostr <<
"* file position: " << pos;
519 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
534 ostr <<
"invalid IDF file\n";
535 ostr <<
"* violation: invalid SIDE value in PLACEMENT RECORD 3 ('";
536 ostr << token <<
"'); must be one of TOP/BOTTOM\n";
537 ostr <<
"* line: '" << iline <<
"'\n";
538 ostr <<
"* file position: " << pos;
540 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
547 ostr <<
"invalid IDF file\n";
548 ostr <<
"* violation: no PLACEMENT value in PLACEMENT RECORD 3\n";
549 ostr <<
"* line: '" << iline <<
"'\n";
550 ostr <<
"* file position: " << pos;
552 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
582 ostr <<
"invalid IDF file\n";
583 ostr <<
"* violation: invalid PLACEMENT value ('";
584 ostr << token <<
"') in PLACEMENT RECORD 3\n";
585 ostr <<
"* line: '" << iline <<
"'\n";
586 ostr <<
"* file position: " << pos;
588 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
593 if(
outline ==
nullptr && !aNoSubstituteOutlines )
596 cerr <<
"* GeomName( " << ngeom <<
" ), PartName( " << npart <<
" )\n";
597 cerr <<
"* Substituting default outline.\n";
601 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
602 "\n* missing outline: cannot create default" ) );
622 catch( std::bad_alloc& )
626 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
627 "cannot create component object" ) );
647 if(
parent->GetPosition( tX, tY, tA, tL ) )
654 ostr <<
"invalid IDF file\n";
655 ostr <<
"* violation: inconsistent PLACEMENT data; ";
658 ostr <<
"* line: '" << iline <<
"'\n";
659 ostr <<
"* file position: " << pos;
661 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
671 parent->SetPlacement( placement );
678 if( placement !=
parent->GetPlacement() )
683 ostr <<
"invalid IDF file\n";
684 ostr <<
"* violation: inconsistent PLACEMENT data; ";
685 ostr <<
"* PLACEMENT value has changed from ";
688 ostr <<
"* line: '" << iline <<
"'\n";
689 ostr <<
"* file position: " << pos;
691 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
702 if( !
parent->AddOutlineData( cdp ) )
706 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
707 "could not add outline data object" ) );
715 double aXpos,
double aYpos,
double aAngle,
716 const std::string& aRefDes,
723 if(
outline->GetUID().empty() )
724 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
725 "empty GEOM and PART names" ) );
729 ERROR_IDF <<
"placement invalid (" << aRefDes <<
":";
737 ostr <<
"must be TOP or BOTTOM\n";
739 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
743 double xpos, ypos, ang;
760 std::string arefdes = aRefDes;
762 if( arefdes.empty() || !arefdes.compare(
"~" )
763 || ( arefdes.size() >= 8 &&
CompareToken(
"NOREFDES", arefdes.substr(0, 8) ) ) )
764 arefdes =
"NOREFDES";
766 aBoardFile <<
"\"" <<
outline->GetGeomName() <<
"\" \"" <<
outline->GetPartName() <<
"\" "
776 aBoardFile << setiosflags(ios::fixed) << setprecision(5) << xpos <<
" "
777 << ypos <<
" " << setprecision(3) <<
zoff <<
" "
782 aBoardFile << setiosflags(ios::fixed) << setprecision(1) << (xpos /
IDF_THOU_TO_MM) <<
" "
784 << setprecision(3) << ang <<
" ";
792 aBoardFile <<
" PLACED\n";
796 aBoardFile <<
" UNPLACED\n";
800 aBoardFile <<
" MCAD\n";
804 aBoardFile <<
" ECAD\n";
826 std::list< IDF3_COMP_OUTLINE_DATA* >::iterator itcS =
components.begin();
827 std::list< IDF3_COMP_OUTLINE_DATA* >::iterator itcE =
components.end();
829 while( itcS != itcE )
837 std::list< IDF_DRILL_DATA* >::iterator itdS =
drills.begin();
838 std::list< IDF_DRILL_DATA* >::iterator itdE =
drills.end();
840 while( itdS != itdE )
850#ifndef DISABLE_IDF_OWNERSHIP
856 ostr << __FILE__ <<
":" << aSourceLine <<
":" << aSourceFunc <<
"():\n";
857 ostr <<
"\n* BUG: parent not set";
877 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"():\n";
878 ostr <<
"\n* ownership violation; internal CAD type (MCAD) conflicts with "
893 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"():\n";
894 ostr <<
"\n* ownership violation; internal CAD type (MCAD) conflicts with "
907 ostr <<
"\n* BUG: unhandled internal placement value (" <<
static_cast<int>(
placement ) <<
")";
930 return parent->GetCadType();
945#ifndef DISABLE_IDF_OWNERSHIP
950 if( aRefDes.empty() )
953 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"(): invalid RefDes (empty)";
962 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"():\n";
963 ostr <<
"* BUG: PANEL is a reserved designator and may not be used by components";
982 const std::string& aHoleType,
991 catch( std::bad_alloc& )
1010 cerr <<
"\n* BUG: PANEL drills not supported at component level\n";
1017 cerr <<
"\n* BUG: pushing an incorrect REFDES ('" << aDrilledHole->
GetDrillRefDes();
1018 cerr <<
"') to component ('" <<
refdes <<
"')\n";
1022 drills.push_back( aDrilledHole );
1024 return aDrilledHole;
1030#ifndef DISABLE_IDF_OWNERSHIP
1042 list< IDF_DRILL_DATA* >::iterator itS =
drills.begin();
1043 list< IDF_DRILL_DATA* >::iterator itE =
drills.end();
1045 while( !
drills.empty() && itS != itE )
1047 if( (*itS)->Matches( aDia, aXpos, aYpos ) )
1051 itS =
drills.erase( itS );
1064#ifndef DISABLE_IDF_OWNERSHIP
1074 list< IDF_DRILL_DATA* >::iterator itS =
drills.begin();
1075 list< IDF_DRILL_DATA* >::iterator itE =
drills.end();
1077 while( !
drills.empty() && itS != itE )
1079 if( *itS == aDrill )
1100 if( aComponentOutline ==
nullptr )
1103 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
1104 "(): invalid aComponentOutline (nullptr)";
1119#ifndef DISABLE_IDF_OWNERSHIP
1127 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"(): component list is empty";
1133 if( aComponentOutline ==
nullptr )
1136 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
1137 "(): invalid aComponentOutline (nullptr)";
1145 std::list< IDF3_COMP_OUTLINE_DATA* >::iterator itS =
components.begin();
1146 std::list< IDF3_COMP_OUTLINE_DATA* >::iterator itE =
components.end();
1150 if( *itS == aComponentOutline )
1166#ifndef DISABLE_IDF_OWNERSHIP
1174 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"():\n";
1175 ostr <<
"* aIndex (" << aIndex <<
") out of range; list size is " <<
components.size();
1181 std::list< IDF3_COMP_OUTLINE_DATA* >::iterator itS =
components.begin();
1182 std::list< IDF3_COMP_OUTLINE_DATA* >::iterator itE =
components.end();
1239#ifndef DISABLE_IDF_OWNERSHIP
1256 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"():\n";
1257 ostr <<
"\n* invalid side (must be TOP or BOTTOM only): " <<
1290 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"():\n";
1291 ostr <<
"\n* invalid PLACEMENT value (" <<
static_cast<int>( aPlacementValue ) <<
")";
1297#ifndef DISABLE_IDF_OWNERSHIP
1313 std::list< IDF_DRILL_DATA* >::iterator itS =
drills.begin();
1314 std::list< IDF_DRILL_DATA* >::iterator itE =
drills.end();
1318 (*itS)->write( aBoardFile,
GetUnit() );
1331 std::list< IDF3_COMP_OUTLINE_DATA* >::iterator itS =
components.begin();
1332 std::list< IDF3_COMP_OUTLINE_DATA* >::iterator itE =
components.end();
1386#ifndef DISABLE_IDF_OWNERSHIP
1393 ostr << __FILE__ <<
":" << aSourceLine <<
":" << aSourceFunc;
1394 ostr <<
"(): Invalid component pointer (nullptr)";
1414 ostr <<
"* " << __FILE__ <<
":" << aSourceLine <<
":" << aSourceFunc <<
"():\n";
1415 ostr <<
"* ownership violation; CAD type is ";
1442 ERROR_IDF <<
"\n* TNM unit is not supported; defaulting to mm\n";
1450 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"():\n";
1451 ostr <<
"* invalid board unit (" <<
static_cast<int>( aUnit ) <<
")";
1467 std::map<std::string, OTHER_OUTLINE*>::iterator its =
m_otherOutlines.begin();
1468 std::map<std::string, OTHER_OUTLINE*>::iterator ite =
m_otherOutlines.end();
1472 its->second->SetUnit( aUnit );
1485 (*its)->SetUnit( aUnit );
1498 (*its)->SetUnit( aUnit );
1511 (*its)->SetUnit( aUnit );
1524 (*its)->SetUnit( aUnit );
1537 (*its)->SetUnit( aUnit );
1545 std::multimap<std::string, GROUP_OUTLINE*>::iterator its =
m_groupOutlines.begin();
1546 std::multimap<std::string, GROUP_OUTLINE*>::iterator ite =
m_groupOutlines.end();
1550 its->second->SetUnit( aUnit );
1565 its->second->SetUnit( aUnit );
1577 if( aBoardThickness <= 0.0 )
1580 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"(): ";
1581 ostr <<
"board thickness (" << aBoardThickness <<
") must be > 0";
1616 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
1617 "\n* BUG: could not add drill data; cannot continue reading the file" ) );
1637 bool aNoSubstituteOutlines )
1651 bool quoted =
false;
1655 while( !
FetchIDFLine( aBoardFile, iline, isComment, pos ) && aBoardFile.good() );
1657 if( !aBoardFile.good() )
1658 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
"problems reading board header" ) );
1662 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
1663 "invalid IDF file\n"
1664 "* Violation of specification: first line must be .HEADER\n" ) );
1669 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
1670 "invalid IDF file\n"
1671 "* Violation of specification:\n"
1672 "* first line must be .HEADER and have no quotes or trailing text" ) );
1681 while( !
FetchIDFLine( aBoardFile, iline, isComment, pos ) && aBoardFile.good() );
1683 if( !aBoardFile.good() )
1684 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
"problems reading board header, RECORD 2" ) );
1688 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
1689 "invalid IDF file\n"
1690 "* Violation of specification: comment within .HEADER section" ) );
1698 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
1699 "invalid IDF file\n"
1700 "* Violation of specification:\n"
1701 "* File Type in HEADER section must not be in quotes" ) );
1710 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
1711 "not a board file\n"
1712 "* PANEL_FILE is not supported (expecting BOARD_FILE)" ) );
1716 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
1717 "invalid IDF file\n"
1718 "* Expecting string: BOARD_FILE" ) );
1724 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
1725 "invalid IDF file\n"
1726 "* Violation of specification: HEADER section, RECORD 2: no FIELD 2" ) );
1731 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
1732 "invalid IDF file\n"
1733 "* Violation of specification: IDF Version must not be in quotes" ) );
1736 if( !token.compare(
"3.0" ) || !token.compare(
"3." ) || !token.compare(
"3" ) )
1740 else if( !token.compare(
"2.0" ) || !token.compare(
"2." ) || !token.compare(
"2" ) )
1748 ostr <<
"unsupported IDF version\n";
1749 ostr <<
"* Expecting version to be a variant of '3.0', '2.0' (value: '" << token <<
"')\n";
1751 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
1756 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
1757 "invalid IDF file\n"
1758 "* Violation of specification:\n"
1759 "* HEADER section, RECORD 2, FIELD 3: no Source System string" ) );
1766 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
1767 "invalid IDF file\n"
1768 "* Violation of specification:\n"
1769 "* HEADER section, RECORD 2, FIELD 4: no Date string" ) );
1776 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
1777 "invalid IDF file\n"
1778 "* Violation of specification:\n"
1779 "* HEADER section, RECORD 2, FIELD 5: no Board File Version number" ) );
1782 std::istringstream istr;
1789 ERROR_IDF <<
"invalid Board File Version in header\n";
1790 cerr <<
"* Setting default version of 1\n";
1796 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
1797 "invalid IDF file\n"
1798 "* Violation of specification:\n"
1799 "* HEADER section, RECORD 2, FIELD 5: Board File Version must not be in quotes" ) );
1805 while( !
FetchIDFLine( aBoardFile, iline, isComment, pos ) && aBoardFile.good() );
1807 if( !aBoardFile.good() )
1808 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
"\n* problems reading board header, RECORD 2" ) );
1812 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
1813 "invalid IDF file\n"
1814 "* Violation of specification: comment within .HEADER section" ) );
1824 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
1825 "invalid IDF file\n"
1826 "* Violation of specification:\n"
1827 "* HEADER section, RECORD 3, FIELD 1: no Board Name" ) );
1832 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
1833 "invalid IDF file\n"
1834 "* Violation of specification:\n"
1835 "* HEADER section, RECORD 3, FIELD 2: UNIT may not be in quotes" ) );
1854 ostr <<
"invalid IDF file\n";
1855 ostr <<
"* HEADER section, RECORD 3, FIELD 2: expecting MM or THOU (got '" << token <<
1858 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
1865 while( !
FetchIDFLine( aBoardFile, iline, isComment, pos ) && aBoardFile.good() );
1867 if( ( !aBoardFile.good() && !aBoardFile.eof() ) || iline.empty() )
1868 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
"problems reading board header, RECORD 4" ) );
1872 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
1873 "invalid IDF file\n"
1874 "* Violation of specification: comment within .HEADER section\n" ) );
1881 ostr <<
"invalid IDF file\n";
1882 ostr <<
"* Violation of specification: expected .END_HEADER\n";
1883 ostr <<
"* line: '" << iline <<
"'";
1885 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
1893 bool aNoSubstituteOutlines )
1895 std::list< std::string > comments;
1915 bool quoted =
false;
1918 while( aBoardFile.good() )
1920 while( !
FetchIDFLine( aBoardFile, iline, isComment, pos ) && aBoardFile.good() );
1922 if( !aBoardFile.good() )
1927 if( !comments.empty() )
1928 ERROR_IDF <<
"[warning]: trailing comments in IDF file (comments will be lost)\n";
1933 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
1934 "problems reading board section" ) );
1939 comments.push_back( iline );
1950 ostr <<
"invalid IDF file\n";
1951 ostr <<
"* Violation of specification: quoted string where SECTION HEADER expected\n";
1952 ostr <<
"* line: '" << iline <<
"'";
1953 ostr <<
"* position: " << pos;
1955 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
1963 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
1964 "invalid IDF file\n"
1965 "* Violation of specification: no HEADER section" ) );
1970 if( !comments.empty() )
1972 std::list<std::string>::iterator its = comments.begin();
1973 std::list<std::string>::iterator ite = comments.end();
1987 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
"PANEL_OUTLINE not supported" ) );
1992 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
1993 "invalid IDF file\n"
1994 "* Violation of specification: expecting .BOARD_OUTLINE, have .OTHER_OUTLINE" ) );
2002 catch( std::bad_alloc& )
2004 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2005 "could not create OTHER_OUTLINE object" ) );
2013 if( !comments.empty() )
2015 std::list<std::string>::iterator its = comments.begin();
2016 std::list<std::string>::iterator ite = comments.end();
2028 ostr <<
"invalid IDF file\n";
2029 ostr <<
"* Violation of specification. Non-unique ID in OTHER_OUTLINE '";
2031 ostr <<
"* line: '" << iline <<
"'\n";
2032 ostr <<
"* pos: " << pos;
2035 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
2045 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2046 "invalid IDF file\n"
2047 "* Violation of specification: expecting .BOARD_OUTLINE, have .ROUTE_OUTLINE" ) );
2056 catch( std::bad_alloc& )
2058 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2059 "could not create ROUTE_OUTLINE object" ) );
2065 if( !comments.empty() )
2067 std::list<std::string>::iterator its = comments.begin();
2068 std::list<std::string>::iterator ite = comments.end();
2086 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2087 "invalid IDF file\n"
2088 "* Violation of specification: expecting .BOARD_OUTLINE, have .PLACE_OUTLINE" ) );
2097 catch( std::bad_alloc& )
2099 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2100 "could not create PLACE_OUTLINE object" ) );
2106 if( !comments.empty() )
2108 std::list<std::string>::iterator its = comments.begin();
2109 std::list<std::string>::iterator ite = comments.end();
2127 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2128 "invalid IDF file\n"
2129 "* Violation of specification: expecting .BOARD_OUTLINE, have .ROUTE_KEEPOUT" ) );
2138 catch( std::bad_alloc& )
2140 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2141 "could not create ROUTE_KEEPOUT object" ) );
2147 if( !comments.empty() )
2149 std::list<std::string>::iterator its = comments.begin();
2150 std::list<std::string>::iterator ite = comments.end();
2168 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2169 "invalid IDF file\n"
2170 "* Violation of specification: expecting .BOARD_OUTLINE, have .VIA_KEEPOUT" ) );
2179 catch( std::bad_alloc& )
2181 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
"could not create VIA_KEEPOUT object" ) );
2187 if( !comments.empty() )
2189 std::list<std::string>::iterator its = comments.begin();
2190 std::list<std::string>::iterator ite = comments.end();
2208 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2209 "invalid IDF file\n"
2210 "* Violation of specification: expecting .BOARD_OUTLINE, have .PLACE_KEEPOUT" ) );
2218 catch( std::bad_alloc& )
2220 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
"could not create PLACE_KEEPOUT object" ) );
2226 if( !comments.empty() )
2228 std::list<std::string>::iterator its = comments.begin();
2229 std::list<std::string>::iterator ite = comments.end();
2247 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2248 "invalid IDF file\n"
2249 "* Violation of specification: expecting .BOARD_OUTLINE, have .PLACE_REGION" ) );
2258 catch( std::bad_alloc& )
2260 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
"could not create PLACE_REGION object" ) );
2266 if( !comments.empty() )
2268 std::list<std::string>::iterator its = comments.begin();
2269 std::list<std::string>::iterator ite = comments.end();
2287 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2288 "invalid IDF file\n"
2289 "* Violation of specification: expecting .BOARD_OUTLINE, have .DRILLED_HOLES" ) );
2294 if( !comments.empty() )
2296 std::list<std::string>::iterator its = comments.begin();
2297 std::list<std::string>::iterator ite = comments.end();
2313 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2314 "invalid IDF file\n"
2315 "* Violation of specification: expecting .BOARD_OUTLINE, have .NOTES" ) );
2320 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2321 "invalid IDFv2 file\n"
2322 "* Violation of specification: NOTES section not in specification" ) );
2327 if( !comments.empty() )
2329 std::list<std::string>::iterator its = comments.begin();
2330 std::list<std::string>::iterator ite = comments.end();
2346 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2347 "invalid IDF file\n"
2348 "* Violation of specification: expecting .BOARD_OUTLINE, have .PLACEMENT" ) );
2353 if( !comments.empty() )
2355 std::list<std::string>::iterator its = comments.begin();
2356 std::list<std::string>::iterator ite = comments.end();
2377 brd.exceptions ( std::ios_base::badbit );
2382 ostr <<
"\n* could not open file: '" << aFileName <<
"'";
2384 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
2387 brd.imbue( std::locale(
"C" ) );
2421 ostr <<
"\n* empty IDF file: '" << aFileName <<
"'";
2423 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
2432 while( !
FetchIDFLine( brd, iline, isComment, pos ) && brd.good() );
2435 if( ( !brd.good() && !brd.eof() ) || iline.empty() )
2440 ERROR_IDF <<
"[warning]: trailing comments after PLACEMENT\n";
2445 ostr <<
"\n* problems reading file: '" << aFileName <<
"'";
2447 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2448 "invalid IDF file\n"
2449 "* Violation of specification: non-comment lines after PLACEMENT section" ) );
2454 catch(
const std::exception& )
2456 brd.exceptions ( std::ios_base::goodbit );
2468 if( aBoard ==
nullptr )
2470 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2471 "\n* BUG: invoked with nullptr reference aBoard" ) );
2474 std::list< std::string > comments;
2481 bool quoted =
false;
2489 catch( std::bad_alloc& )
2491 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
"\n* memory allocation failure" ) );
2494 while( aLibFile.good() )
2496 while( !
FetchIDFLine( aLibFile, iline, isComment, pos ) && aLibFile.good() );
2498 if( !aLibFile.good() && !aLibFile.eof() )
2501 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
"problems reading library section" ) );
2513 comments.push_back( iline );
2523 ostr <<
"invalid IDF library\n";
2524 ostr <<
"* Violation of specification: quoted string where .ELECTRICAL or .MECHANICAL expected\n";
2525 ostr <<
"* line: '" << iline <<
"'\n";
2526 ostr <<
"* pos: " << pos;
2529 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
2536 if( !comments.empty() )
2538 std::list<std::string>::iterator its = comments.begin();
2539 std::list<std::string>::iterator ite = comments.end();
2550 if( cop ==
nullptr )
2564 ostr <<
"invalid IDF library\n";
2565 ostr <<
"duplicate Component Outline: '" << pout->
GetUID() <<
"'\n";
2566 ostr <<
"* Violation of specification: multiple outlines have the same GEOM and PART name\n";
2567 ostr <<
"* line: '" << iline <<
"'\n";
2568 ostr <<
"* pos: " << pos;
2571 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
2579 ostr <<
"invalid IDF library\n";
2580 ostr <<
"* Expecting .ELECTRICAL or .MECHANICAL, got '" << token <<
"'\n";
2581 ostr <<
"* line: '" << iline <<
"'\n";
2582 ostr <<
"* pos: " << pos;
2585 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
2591 if( !aLibFile.eof() )
2592 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
"problems reading IDF library file" ) );
2603 bool quoted =
false;
2607 while( !
FetchIDFLine( aLibFile, iline, isComment, pos ) && aLibFile.good() );
2609 if( !aLibFile.good() )
2611 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2612 "invalid IDF library file\n"
2613 "* premature end of file (no HEADER)" ) );
2618 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2619 "invalid IDF library file\n"
2620 "* Violation of specification: first line must be .HEADER" ) );
2625 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2626 "invalid IDF library file\n"
2627 "* Violation of specification:\n"
2628 "* first line must be .HEADER and have no quotes or trailing text" ) );
2637 while( !
FetchIDFLine( aLibFile, iline, isComment, pos ) && aLibFile.good() );
2639 if( !aLibFile.good() )
2641 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2642 "invalid IDF library file\n"
2643 "* premature end of HEADER" ) );
2648 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2649 "invalid IDF library file\n"
2650 "* Violation of specification: comment within .HEADER section" ) );
2658 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2659 "invalid IDF library file\n"
2660 "* Violation of specification:\n"
2661 "* file Type in HEADER section must not be in quotes" ) );
2667 ostr <<
"invalid IDF library\n";
2668 ostr <<
"* Expecting string: LIBRARY_FILE (got '" << token <<
"')\n";
2670 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
2675 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2676 "invalid IDF library file\n"
2677 "* Violation of specification: HEADER section, RECORD 2: no FIELD 2" ) );
2682 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2683 "invalid IDF library file\n"
2684 "* Violation of specification: IDF Version must not be in quotes" ) );
2687 if( !token.compare(
"3.0" ) || !token.compare(
"3." ) || !token.compare(
"3" ) )
2691 else if( !token.compare(
"2.0" ) || !token.compare(
"2." ) || !token.compare(
"2" ) )
2699 ostr <<
"unsupported IDF version\n";
2700 ostr <<
"* Expecting version to be a variant of '3.0', '2.0' (value: '" << token <<
"')\n";
2702 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
2707 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2708 "invalid IDF library file\n"
2709 "* Violation of specification:\n"
2710 "* HEADER section, RECORD 2, FIELD 3: no Source System string" ) );
2717 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2718 "invalid IDF library file\n"
2719 "* Violation of specification:\n"
2720 "* HEADER section, RECORD 2, FIELD 4: no Date string" ) );
2727 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2728 "invalid IDF library file\n"
2729 "* Violation of specification:\n"
2730 "* HEADER section, RECORD 2, FIELD 5: no Board File Version number" ) );
2733 std::istringstream istr;
2740 ERROR_IDF <<
"invalid Library File Version in header\n";
2741 cerr <<
"* Setting default version of 1\n";
2747 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2748 "invalid IDF library file\n"
2749 "* Violation of specification:\n"
2750 "* HEADER section, RECORD 2, FIELD 5: Library File Version must not be in quotes" ) );
2755 while( !
FetchIDFLine( aLibFile, iline, isComment, pos ) && aLibFile.good() );
2757 if( ( !aLibFile.good() && !aLibFile.eof() ) || iline.empty() )
2758 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
"problems reading library header, RECORD 3" ) );
2762 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__,
2763 "invalid IDF library file\n"
2764 "* Violation of specification: comment within .HEADER section" ) );
2770 ostr <<
"invalid IDF header\n";
2771 ostr <<
"* Violation of specification: expected .END_HEADER (got '" << iline <<
"')\n";
2773 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
2786 lib.exceptions ( std::ios_base::badbit );
2791 ostr <<
"\n* could not open file: '" << aFileName <<
"'";
2793 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
2796 lib.imbue( std::locale(
"C" ) );
2803 catch(
const std::exception& )
2805 lib.exceptions ( std::ios_base::goodbit );
2820 wxFileName brdname( aFullFileName );
2821 wxFileName libname( aFullFileName );
2822 wxString ext = brdname.GetExt();
2824 if( !ext.Cmp( wxT(
"EMN" ) ) )
2826 libname.SetExt( wxT(
"EMP" ) );
2828 else if( !ext.Cmp( wxT(
"emn" ) ) )
2830 libname.SetExt( wxT(
"emp" ) );
2835 ostr << __FILE__ <<
": " << __FUNCTION__ <<
": " << __LINE__ <<
"\n";
2836 ostr <<
"* [INFO] invalid file name: '" << aFullFileName.ToUTF8() <<
"'";
2842 brdname.SetExt( wxT(
"emn" ) );
2844 std::string bfname =
TO_UTF8( aFullFileName );
2846 if( !wxFileExists( bfname ) )
2848 brdname.SetExt( wxT(
"EMN" ) );
2849 libname.SetExt( wxT(
"EMP" ) );
2854 if( !brdname.IsOk() )
2857 ostr <<
"\n* invalid file name: '" << aFullFileName.ToUTF8() <<
"'";
2859 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
2862 if( !brdname.FileExists() )
2865 ostr <<
"\n* no such file: '" << aFullFileName.ToUTF8() <<
"'";
2867 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
2870 if( !brdname.IsFileReadable() )
2873 ostr <<
"\n* cannot read file: '" << bfname <<
"'";
2875 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
2878 bfname =
TO_UTF8( brdname.GetFullPath() );
2879 std::string lfname =
TO_UTF8( libname.GetFullPath() );
2881 if( !libname.FileExists() )
2887 cerr <<
"no associated library file (*.emp)\n";
2889 else if( !libname.IsFileReadable() )
2892 ostr <<
"\n* cannot read library file: '" << lfname <<
"'";
2894 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
2905 catch(
const std::exception& e )
2923 lib.exceptions( std::ios_base::failbit );
2928 ostr <<
"\n* could not open file: '" << aFileName <<
"'";
2930 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
2933 lib.imbue( std::locale(
"C" ) );
2934 wxDateTime tdate( time(
nullptr ) );
2939 ostringstream fileDate;
2940 fileDate << setfill(
'0' ) << setw(4) << tdate.GetYear();
2941 fileDate <<
"/" << setw(2) << tdate.GetMonth() <<
"/" << tdate.GetDay();
2942 fileDate <<
"." << tdate.GetHour() <<
":" << tdate.GetMinute() <<
":" << tdate.GetSecond();
2946 lib <<
"LIBRARY_FILE 3.0 \"Created by " <<
m_idfSource;
2948 lib <<
".END_HEADER\n\n";
2955 its->second->writeData( lib );
2960 catch(
const std::exception& )
2962 lib.exceptions( std::ios_base::goodbit );
2978 brd.exceptions( std::ostream::failbit );
2983 ostr <<
"\n* could not open file: '" << aFileName <<
"'";
2985 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
2988 brd.imbue( std::locale(
"C" ) );
2989 wxDateTime tdate( time(
nullptr ) );
2994 ostringstream fileDate;
2995 fileDate << setfill(
'0' ) << setw(4) << tdate.GetYear();
2996 fileDate <<
"/" << setw(2) << tdate.GetMonth() <<
"/" << tdate.GetDay();
2997 fileDate <<
"." << tdate.GetHour() <<
":" << tdate.GetMinute() <<
":" << tdate.GetSecond();
3001 brd <<
"BOARD_FILE 3.0 \"Created by " <<
m_idfSource;
3005 brd <<
"\"BOARD WITH NO NAME\" ";
3009 brd << setw(1) << setfill(
' ' );
3016 brd <<
".END_HEADER\n\n";
3024 std::map<std::string, OTHER_OUTLINE*>::iterator its =
m_otherOutlines.begin();
3025 std::map<std::string, OTHER_OUTLINE*>::iterator ite =
m_otherOutlines.end();
3029 its->second->writeData( brd );
3043 (*its)->writeData( brd );
3057 (*its)->writeData( brd );
3071 (*its)->writeData( brd );
3085 (*its)->writeData( brd );
3099 (*its)->writeData( brd );
3108 std::multimap<std::string, GROUP_OUTLINE*>::iterator its =
m_groupOutlines.begin();
3109 std::multimap<std::string, GROUP_OUTLINE*>::iterator ite =
m_groupOutlines.end();
3113 its->second->writeData( brd );
3125 while( itds != itde )
3127 brd <<
"# " << *itds <<
"\n";
3131 brd <<
".DRILLED_HOLES\n";
3133 std::list<IDF_DRILL_DATA*>::iterator itbs =
m_drills.begin();
3134 std::list<IDF_DRILL_DATA*>::iterator itbe =
m_drills.end();
3136 while( itbs != itbe )
3138 (*itbs)->write( brd,
m_unit );
3142 std::map<std::string, IDF3_COMPONENT*>::iterator itcs =
m_components.begin();
3143 std::map<std::string, IDF3_COMPONENT*>::iterator itce =
m_components.end();
3145 while( itcs != itce )
3147 itcs->second->writeDrillData( brd );
3151 brd <<
".END_DRILLED_HOLES\n\n";
3160 while( itncs != itnce )
3162 brd <<
"# " << *itncs <<
"\n";
3168 std::list<IDF_NOTE*>::iterator itns =
m_notes.begin();
3169 std::list<IDF_NOTE*>::iterator itne =
m_notes.end();
3171 while( itns != itne )
3173 (*itns)->writeNote( brd,
m_unit );
3177 brd <<
".END_NOTES\n\n";
3187 while( itpcs != itpce )
3189 brd <<
"# " << *itpcs <<
"\n";
3193 std::map< std::string, IDF3_COMPONENT*>::iterator itcs =
m_components.begin();
3194 std::map< std::string, IDF3_COMPONENT*>::iterator itce =
m_components.end();
3201 bool hasOutlines =
false;
3203 while( itcs != itce )
3205 if( itcs->second->GetOutlinesSize() > 0 )
3217 brd <<
".PLACEMENT\n";
3219 while( itcs != itce )
3221 itcs->second->writePlaceData( brd );
3225 brd <<
".END_PLACEMENT\n";
3231 catch(
const std::exception& )
3233 brd.exceptions( std::ios_base::goodbit );
3246 wxFileName brdname( aFullFileName );
3247 wxFileName libname( aFullFileName );
3252 std::string bfname =
TO_UTF8( aFullFileName );
3256 if( !brdname.IsOk() )
3260 aReporter->
Report( wxString::Format(
_(
"Invalid output path: %s" ), brdname.GetFullPath() ),
3267 if( brdname.FileExists() && !brdname.IsFileWritable() )
3271 aReporter->
Report( wxString::Format(
_(
"Cannot overwrite file: %s" ), brdname.GetFullPath() ),
3278 bfname =
TO_UTF8( brdname.GetFullPath() );
3279 std::string lfname =
TO_UTF8( libname.GetFullPath() );
3281 if( libname.FileExists() && !libname.IsFileWritable() )
3285 aReporter->
Report( wxString::Format(
_(
"Cannot overwrite file: %s" ), libname.GetFullPath() ),
3295 catch(
const std::exception& e )
3314 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"():\n";
3315 ostr <<
"* board version (" << aVersion <<
") must be >= 0";
3332 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"():\n";
3333 ostr <<
"* library version (" << aVersion <<
") must be >= 0";
3347 if( aScaleFactor == 0.0 )
3350 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"():\n";
3351 ostr <<
"* BUG: user scale factor must not be 0";
3364 if( aPrecision < 1 || aPrecision > 8 )
3367 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"():\n";
3368 ostr <<
"* precision value (" << aPrecision <<
") must be 1..8";
3438 const std::string& aHoleType,
3445 drill =
new IDF_DRILL_DATA( aDia, aXpos, aYpos, aPlating,
"BOARD", aHoleType, aOwner );
3447 catch( std::bad_alloc& )
3468 m_drills.push_back( aDrilledHole );
3469 return aDrilledHole;
3480 std::list<IDF_DRILL_DATA*>::iterator sp =
m_drills.begin();
3481 std::list<IDF_DRILL_DATA*>::iterator ep =
m_drills.end();
3486 if( (*sp)->Matches( aDia, aXpos, aYpos ) )
3488#ifndef DISABLE_IDF_OWNERSHIP
3502 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"():\n";
3503 ostr <<
"* ownership violation; drill owner (";
3516 ostr <<
"invalid: " <<
static_cast<int>( keyo );
3520 ostr <<
") may not be modified by ";
3552 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"():\n";
3553 ostr <<
"* slot width (" << aWidth <<
") must be >= " <<
IDF_MIN_DIA_MM;
3562 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"():\n";
3563 ostr <<
"* slot length (" << aLength <<
") must be >= " <<
IDF_MIN_DIA_MM;
3572 double a1 = aOrientation / 180.0 *
M_PI;
3573 double a2 = a1 + M_PI_2;
3574 double d1 = aLength / 2.0;
3575 double d2 = aWidth / 2.0;
3576 double sa1 = sin( a1 );
3577 double ca1 = cos( a1 );
3578 double dsa2 = d2 * sin( a2 );
3579 double dca2 = d2 * cos( a2 );
3581 c[0].
x = aX + d1 * ca1;
3582 c[0].
y = aY + d1 * sa1;
3584 c[1].
x = aX - d1 * ca1;
3585 c[1].
y = aY - d1 * sa1;
3587 pt[0].
x = c[0].
x - dca2;
3588 pt[0].
y = c[0].
y - dsa2;
3590 pt[1].
x = c[1].
x - dca2;
3591 pt[1].
y = c[1].
y - dsa2;
3593 pt[2].
x = c[1].
x + dca2;
3594 pt[2].
y = c[1].
y + dsa2;
3596 pt[3].
x = c[0].
x + dca2;
3597 pt[3].
y = c[0].
y + dsa2;
3605 catch( std::bad_alloc& )
3608 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"():\n";
3609 ostr <<
"* could not create an outline object";
3617 outline->
push( seg );
3620 seg =
new IDF_SEGMENT( c[1], pt[1], -180.0,
true );
3621 outline->
push( seg );
3625 outline->
push( seg );
3628 seg =
new IDF_SEGMENT( c[0], pt[3], -180.0,
true );
3629 outline->
push( seg );
3643 const std::string& aHoleType,
3645 const std::string& aRefDes )
3655 std::string refdes = aRefDes;
3660 if( refdes.empty() )
3661 refdes =
"NOREFDES";
3665 return AddBoardDrill( aDia, aXpos, aYpos, aPlating, aHoleType, aOwner );
3670 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"():\n";
3671 ostr <<
"* PANEL data not supported";
3677 std::map<std::string, IDF3_COMPONENT*>::iterator ref =
m_components.find( refdes );
3687 catch( std::bad_alloc& )
3690 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"():\n";
3691 ostr <<
"* could not create new component object";
3697 comp->SetParent(
this );
3698 comp->SetRefDes( refdes );
3703 IDF_DRILL_DATA* dp = ref->second->AddDrill( aDia, aXpos, aYpos, aPlating, aHoleType, aOwner );
3720 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"(): nullptr pointer";
3729 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"():\n";
3730 ostr <<
"* PANEL data not supported";
3746 catch( std::bad_alloc& )
3749 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"():\n";
3750 ostr <<
"* could not create new component object";
3756 comp->SetParent(
this );
3777 std::map<std::string, IDF3_COMPONENT*>::iterator ref =
m_components.find( aRefDes );
3782 if( !ref->second->DelDrill( aDia, aXpos, aYpos ) )
3797 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__;
3798 ostr <<
"(): Invalid component pointer (nullptr)";
3807 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"(): \n";
3808 ostr <<
"* duplicate RefDes ('" << aComponent->
GetRefDes() <<
"')";
3822#ifndef DISABLE_IDF_OWNERSHIP
3844 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"(): \n";
3845 ostr <<
"* aIndex (" << aIndex <<
") out of range (" <<
m_components.size() <<
")";
3851 std::map<std::string, IDF3_COMPONENT*>::iterator it =
m_components.begin();
3853 while( aIndex-- > 0 ) ++it;
3855#ifndef DISABLE_IDF_OWNERSHIP
3881 std::map<std::string, IDF3_COMPONENT*>::iterator it =
m_components.find( aRefDes );
3892 std::string fname =
TO_UTF8( aFullFileName );
3893 wxFileName idflib( aFullFileName );
3895 if( !idflib.IsOk() )
3898 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"(): \n";
3899 cerr <<
"* invalid file name: '" << fname <<
"'";
3905 if( !idflib.FileExists() )
3908 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"(): \n";
3909 cerr <<
"* no such file: '" << fname <<
"'";
3915 if( !idflib.IsFileReadable() )
3918 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"(): \n";
3919 cerr <<
"* cannot read file: '" << fname <<
"'";
3925 std::map<std::string, std::string>::iterator itm =
m_uidFileList.find( fname );
3936 catch( std::bad_alloc& )
3939 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"(): \n";
3940 cerr <<
"* failed to create outline\n";
3941 cerr <<
"* filename: '" << fname <<
"'";
3951 model.exceptions ( std::ios_base::badbit );
3956 ostr <<
"\n* could not open file: '" << fname <<
"'";
3958 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
3961 model.imbue( std::locale(
"C" ) );
3973 ostr <<
"\n* problems reading file: '" << fname <<
"'";
3974 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
3992 ostr <<
"faulty IDF component definition\n";
3993 ostr <<
"* Expecting .ELECTRICAL or .MECHANICAL, got '" << iline <<
"'\n";
3994 cerr <<
"* File: '" << fname <<
"'\n";
3996 throw(
IDF_ERROR( __FILE__, __FUNCTION__, __LINE__, ostr.str() ) );
4000 catch(
const std::exception& e )
4003 model.exceptions ( std::ios_base::goodbit );
4012 std::list<std::string>::iterator lsts =
m_uidLibList.begin();
4013 std::list<std::string>::iterator lste =
m_uidLibList.end();
4014 std::string uid = cp->
GetUID();
4017 while( lsts != lste )
4019 if( ! lsts->compare( uid ) )
4038 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"():\n";
4039 ostr <<
"* duplicate UID for different Component Outlines: '" << uid <<
"'\n";
4040 ostr <<
"* original loaded from library, duplicate in current file\n";
4041 ostr <<
"* file: '" << fname <<
"'";
4054 if( oldp ==
nullptr )
4078 std::map<std::string, std::string>::iterator ufls =
m_uidFileList.begin();
4079 std::map<std::string, std::string>::iterator ufle =
m_uidFileList.end();
4080 std::string oldfname;
4082 while( ufls != ufle )
4084 if( ! ufls->second.compare( uid ) )
4086 oldfname = ufls->first;
4094 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"():\n";
4095 ostr <<
"* duplicate UID for different Component Outlines: '" << uid <<
"'\n";
4096 ostr <<
"* original file: '" << oldfname <<
"'\n";
4097 ostr <<
"* this file: '" << fname <<
"'";
4106 std::map< std::string, IDF3_COMP_OUTLINE*>::iterator its =
m_componentOutlines.find( aComponentID );
4116 const std::string& aPartName )
4127 catch( std::bad_alloc& )
4130 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"(): \n";
4131 cerr <<
"could not create new outline";
4146 const std::string& aPartName )
4151 if( aGeomName.empty() && aPartName.empty() )
4153 uid =
"NOGEOM_NOPART";
4158 uid = aGeomName +
"_" + aPartName;
4170 catch( std::bad_alloc& )
4173 ostr << __FILE__ <<
":" << __LINE__ <<
":" << __FUNCTION__ <<
"(): ";
4174 cerr <<
"could not create new outline";
4223 std::list<IDF_DRILL_DATA*>::iterator ds =
m_drills.begin();
4224 std::list<IDF_DRILL_DATA*>::iterator de =
m_drills.end();
4239 std::map<std::string, IDF3_COMPONENT*>::iterator
cs =
m_components.begin();
4240 std::map<std::string, IDF3_COMPONENT*>::iterator ce =
m_components.end();
4271 std::map<std::string, OTHER_OUTLINE*>::iterator os =
m_otherOutlines.begin();
4272 std::map<std::string, OTHER_OUTLINE*>::iterator oe =
m_otherOutlines.end();
4367 std::multimap<std::string, GROUP_OUTLINE*>::iterator os =
m_groupOutlines.begin();
4368 std::multimap<std::string, GROUP_OUTLINE*>::iterator oe =
m_groupOutlines.end();
IDF_OUTLINE * GetOutline(size_t aIndex)
Return a pointer to the outline as specified by aIndex.
size_t OutlinesSize(void)
virtual bool SetUnit(IDF3::IDF_UNIT aUnit)
Function SetUnit sets the native unit of the outline; except for component outlines this must be the ...
void AddComment(const std::string &aComment)
Add a comment to the outline data.
Regions and layers in which user-specified features or components may be placed.
virtual void readData(std::istream &aBoardFile, const std::string &aHeader, IDF3::IDF_VERSION aIdfVersion) override
Read GROUP_OUTLINE data from an open IDFv3 file.
virtual const std::string & GetGroupName(void)
Return a reference to the (non-unique) group name.
void GetUserOffset(double &aXoff, double &aYoff)
bool WriteFile(const wxString &aFullFileName, IDF3::IDF_UNIT aUnits, REPORTER *aReporter=nullptr)
std::list< std::string > m_uidLibList
std::list< IDF_DRILL_DATA * > m_drills
void readLibFile(const std::string &aFileName)
void readLibSection(std::istream &aLibFile, IDF3::FILE_STATE &aLibState, IDF3_BOARD *aBoard)
std::list< VIA_KO_OUTLINE * > m_viaKeepoutOutlines
bool SetBoardThickness(double aBoardThickness)
bool SetLibraryVersion(int aVersion)
std::map< std::string, OTHER_OUTLINE * > m_otherOutlines
bool setUnit(IDF3::IDF_UNIT aUnit, bool convert=false)
std::list< std::string > m_placeComments
IDF3_COMP_OUTLINE * GetComponentOutline(const wxString &aFullFileName)
const std::string & GetNewRefDes(void)
std::map< std::string, IDF3_COMP_OUTLINE * > m_componentOutlines
std::list< IDF_NOTE * > m_notes
bool writeLibFile(const std::string &aFileName)
void SetUserOffset(double aXoff, double aYoff)
void readBrdNotes(std::istream &aBoardFile, IDF3::FILE_STATE &aBoardState)
std::map< std::string, std::string > m_uidFileList
std::list< PLACE_OUTLINE * > m_placeOutlines
std::list< ROUTE_KO_OUTLINE * > m_routeKeepoutOutlines
IDF3::CAD_TYPE GetCadType(void)
std::string m_refDesString
std::multimap< std::string, GROUP_OUTLINE * > m_groupOutlines
bool DelBoardOutline(IDF_OUTLINE *aOutline)
IDF_DRILL_DATA * AddBoardDrill(double aDia, double aXpos, double aYpos, IDF3::KEY_PLATING aPlating, const std::string &aHoleType, IDF3::KEY_OWNER aOwner)
IDF3::IDF_VERSION m_idfVer
bool ReadFile(const wxString &aFullFileName, bool aNoSubstituteOutlines=false)
bool delCompDrill(double aDia, double aXpos, double aYpos, const std::string &aRefDes)
void writeBoardFile(const std::string &aFileName)
std::map< std::string, IDF3_COMPONENT * > * GetComponents(void)
IDF3_COMPONENT * FindComponent(const std::string &aRefDes)
IDF_DRILL_DATA * AddDrill(IDF_DRILL_DATA *aDrilledHole)
void readBrdHeader(std::istream &aBoardFile, IDF3::FILE_STATE &aBoardState)
size_t GetComponentsSize(void)
double GetBoardThickness(void)
void readLibHeader(std::istream &aLibFile, IDF3::FILE_STATE &aLibState)
bool AddComponent(IDF3_COMPONENT *aComponent)
void readBrdDrills(std::istream &aBoardFile, IDF3::FILE_STATE &aBoardState)
size_t GetBoardOutlinesSize(void)
bool SetUserScale(double aScaleFactor)
std::list< ROUTE_OUTLINE * > m_routeOutlines
bool checkComponentOwnership(int aSourceLine, const char *aSourceFunc, IDF3_COMPONENT *aComponent)
void readBoardFile(const std::string &aFileName, bool aNoSubstituteOutlines)
void readBrdPlacement(std::istream &aBoardFile, IDF3::FILE_STATE &aBoardState, bool aNoSubstituteOutlines)
void readBrdSection(std::istream &aBoardFile, IDF3::FILE_STATE &aBoardState, bool aNoSubstituteOutlines)
IDF3::IDF_UNIT GetUnit(void) const
bool SetUserPrecision(int aPrecision)
std::list< PLACE_KO_OUTLINE * > m_placeKeepoutOutlines
bool DelBoardDrill(double aDia, double aXpos, double aYpos)
BOARD_OUTLINE m_boardOutline
IDF3_BOARD(IDF3::CAD_TYPE aCadType)
IDF3_COMP_OUTLINE * GetInvalidOutline(const std::string &aGeomName, const std::string &aPartName)
std::list< std::string > m_drillComments
bool DelComponent(IDF3_COMPONENT *aComponent)
bool AddSlot(double aWidth, double aLength, double aOrientation, double aX, double aY)
bool SetBoardVersion(int aVersion)
bool AddBoardOutline(IDF_OUTLINE *aOutline)
std::map< std::string, IDF3_COMPONENT * > m_components
IDF_DRILL_DATA * addCompDrill(double aDia, double aXpos, double aYpos, IDF3::KEY_PLATING aPlating, const std::string &aHoleType, IDF3::KEY_OWNER aOwner, const std::string &aRefDes)
std::list< std::string > m_noteComments
const std::list< IDF3_COMP_OUTLINE_DATA * > * GetOutlinesData(void)
IDF3::IDF_PLACEMENT placement
const std::string & GetRefDes(void)
Retrieve the Reference Designator (RefDes) of this component.
bool SetPlacement(IDF3::IDF_PLACEMENT aPlacementValue)
Set the placement value of the component subject to ownership rules.
bool writeDrillData(std::ostream &aBoardFile)
Write the internal drill data to an IDFv3 .DRILLED_HOLES section.
bool DeleteOutlineData(IDF3_COMP_OUTLINE_DATA *aComponentOutline)
Remove outline data based on the pointer provided.
std::list< IDF_DRILL_DATA * > drills
IDF3_COMPONENT(IDF3_BOARD *aParent)
Set the parent object and initializes other internal parameters to default values.
bool SetPosition(double aXpos, double aYpos, double aAngle, IDF3::IDF_LAYER aLayer)
Set the internal position parameters and returns true if the position was set, false if the position ...
std::list< IDF3_COMP_OUTLINE_DATA * > components
const std::list< IDF_DRILL_DATA * > * GetDrills(void)
Return the internal list of drills.
bool SetRefDes(const std::string &aRefDes)
Set the Reference Designator (RefDes) of this component.
void SetParent(IDF3_BOARD *aParent)
Set the parent object.
IDF3::IDF_UNIT GetUnit(void)
IDF3::CAD_TYPE GetCadType(void)
bool hasPosition
True after SetPosition is called once.
bool checkOwnership(int aSourceLine, const char *aSourceFunc)
bool writePlaceData(std::ostream &aBoardFile)
Write the component placement data to an IDFv3 .PLACEMENT section.
IDF_DRILL_DATA * AddDrill(double aDia, double aXpos, double aYpos, IDF3::KEY_PLATING aPlating, const std::string &aHoleType, IDF3::KEY_OWNER aOwner)
Add a drill entry to the component and returns its pointer.
std::string refdes
Reference Description (MUST BE UNIQUE)
size_t GetOutlinesSize(void)
bool GetPosition(double &aXpos, double &aYpos, double &aAngle, IDF3::IDF_LAYER &aLayer)
Retrieve the internal position parameters and returns true if the position was previously set,...
bool DelDrill(double aDia, double aXpos, double aYpos)
Delete a drill entry based on its size and location.
IDF3::IDF_PLACEMENT GetPlacement(void)
bool AddOutlineData(IDF3_COMP_OUTLINE_DATA *aComponentOutline)
Add the given component outline data to this component.
bool checkOwnership(int aSourceLine, const char *aSourceFunc)
bool readPlaceData(std::istream &aBoardFile, IDF3::FILE_STATE &aBoardState, IDF3_BOARD *aBoard, IDF3::IDF_VERSION aIdfVersion, bool aNoSubstituteOutlines)
Read placement data from an open IDFv3 file.
void GetOffsets(double &aXoff, double &aYoff, double &aZoff, double &aAngleOff)
Retrieve the position and orientation of this outline item in relation to its parent.
IDF3_COMP_OUTLINE * outline
void writePlaceData(std::ostream &aBoardFile, double aXpos, double aYpos, double aAngle, const std::string &aRefDes, IDF3::IDF_PLACEMENT aPlacement, IDF3::IDF_LAYER aSide)
Write RECORD 2 and RECORD 3 of a PLACEMENT section as per IDFv3 specification.
IDF3_COMP_OUTLINE_DATA()
Create an object with default settings and no parent or associated outline.
~IDF3_COMP_OUTLINE_DATA()
void SetParent(IDF3_COMPONENT *aParent)
Set the parent object.
bool SetOutline(IDF3_COMP_OUTLINE *aOutline)
Set the outline whose position is managed by this object.
bool SetOffsets(double aXoff, double aYoff, double aZoff, double aAngleOff)
Set the position and orientation of this outline item in relation to its parent.
friend class IDF3_COMPONENT
A component's outline as stored in an IDF library file.
void SetPartName(const std::string &aPartName)
Set the Part Name (Part Number, IDFv3 spec) of the component outline.
const std::string & GetUID(void)
virtual void readData(std::istream &aLibFile, const std::string &aHeader, IDF3::IDF_VERSION aIdfVersion) override
Read a component outline from an open IDFv3 file.
IDF3::COMP_TYPE GetComponentClass(void)
bool CreateDefaultOutline(const std::string &aGeom, const std::string &aPart)
Create a default outline with the given Geometry and Part names.
void SetGeomName(const std::string &aGeomName)
Set the Geometry Name (Package Name, IDFv3 spec) of the component outline.
int incrementRef(void)
Increment the internal reference counter to keep track of the number of components referring to this ...
const std::string & GetDrillRefDes()
bool read(std::istream &aBoardFile, IDF3::IDF_UNIT aBoardUnit, IDF3::FILE_STATE aBoardState, IDF3::IDF_VERSION aIdfVersion)
Read a drill entry from an IDFv3 file.
An entry in the NOTE section of an IDF file.
bool readNote(std::istream &aBoardFile, IDF3::FILE_STATE &aBoardState, IDF3::IDF_UNIT aBoardUnit)
Read a note entry from an IDFv3 file.
A segment and winding information for an IDF outline.
std::list< IDF_SEGMENT * >::iterator end()
std::list< IDF_SEGMENT * >::iterator begin()
bool push(IDF_SEGMENT *item)
Add a segment to the internal segment list.
A point as used by the various IDF related classes.
A segment as used in IDFv3 outlines.
Miscellaneous extrusions on the board.
virtual void readData(std::istream &aBoardFile, const std::string &aHeader, IDF3::IDF_VERSION aIdfVersion) override
Read an OTHER_OUTLINE data from an IDFv3 file.
virtual const std::string & GetOutlineIdentifier(void)
Function GetOutlineIdentifier returns the object's Outline Identifier.
Regions and layers in which no component may be placed or on which a maximum component height is in e...
Area on the board for placing components.
virtual void readData(std::istream &aBoardFile, const std::string &aHeader, IDF3::IDF_VERSION aIdfVersion) override
Read PLACE_OUTLINE data from an open IDFv3 file.
A pure virtual class used to derive REPORTER objects from.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Report a string with a given severity.
Regions and layers where no electrical routing is permitted.
Routing areas on the board.
virtual void readData(std::istream &aBoardFile, const std::string &aHeader, IDF3::IDF_VERSION aIdfVersion) override
Read ROUTE_OUTLINE data from an IDFv3 file.
Region in which vias are prohibited.
static bool empty(const wxTextEntryBase *aCtrl)
static const std::string IdfV3LibraryFileExtension
static const std::string IdfV3BoardFileExtension
static bool MatchCompOutline(IDF3_COMP_OUTLINE *aOutlineA, IDF3_COMP_OUTLINE *aOutlineB)
std::string GetPlacementString(IDF3::IDF_PLACEMENT aPlacement)
Return a string representing the given IDF Placement type.
FILE_STATE
State values for the IDF parser's input.
KEY_PLATING
The plating condition of a hole.
IDF_PLACEMENT
The placement status of a component.
bool GetIDFString(const std::string &aLine, std::string &aIDFString, bool &hasQuotes, int &aIndex)
Parse a line retrieved via FetchIDFLine() and returns the first IDF string found from the starting po...
CAD_TYPE
The class of CAD program which is opening or modifying a file.
bool FetchIDFLine(std::istream &aModel, std::string &aLine, bool &isComment, std::streampos &aFilePos)
Retrieve a single line from an IDF file and performs minimal processing.
IDF_VERSION
The supported IDF versions (3.0 and 2.0 ONLY).
IDF_UNIT
The native unit of the board and of component outlines.
bool CompareToken(const char *aTokenString, const std::string &aInputString)
Perform a case-insensitive comparison of a token string and an input string.
IDF_LAYER
The various IDF layer classes and groupings.
KEY_OWNER
The type of CAD which has ownership an object.
bool WriteLayersText(std::ostream &aBoardFile, IDF3::IDF_LAYER aLayer)
Write out text corresponding to the given IDF Layer type.
std::string GetLayerString(IDF3::IDF_LAYER aLayer)
Return a string representing the given IDF Layer type.
#define OPEN_OSTREAM(var, name)
#define CLOSE_STREAM(var)
#define OPEN_ISTREAM(var, name)
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition of file extensions used in Kicad.