当前位置: 首页>>代码示例>>C++>>正文


C++ PCB_EDIT_FRAME::DoGenFootprintsPositionFile方法代码示例

本文整理汇总了C++中PCB_EDIT_FRAME::DoGenFootprintsPositionFile方法的典型用法代码示例。如果您正苦于以下问题:C++ PCB_EDIT_FRAME::DoGenFootprintsPositionFile方法的具体用法?C++ PCB_EDIT_FRAME::DoGenFootprintsPositionFile怎么用?C++ PCB_EDIT_FRAME::DoGenFootprintsPositionFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PCB_EDIT_FRAME的用法示例。


在下文中一共展示了PCB_EDIT_FRAME::DoGenFootprintsPositionFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateFiles

bool DIALOG_GEN_MODULE_POSITION::CreateFiles()
{
    BOARD * brd = m_parent->GetBoard();
    wxFileName  fn;
    wxString    msg;
    bool singleFile = OneFileOnly();
    int fullcount = 0;

    // Count the footprints to place, do not yet create a file
    int fpcount = m_parent->DoGenFootprintsPositionFile( wxEmptyString, UnitsMM(),
                  ForceAllSmd(), 2 );
    if( fpcount == 0)
    {
        wxMessageBox( _( "No modules for automated placement." ) );
        return false;
    }

    // Create output directory if it does not exist (also transform it in
    // absolute form). Bail if it fails
    wxFileName  outputDir = wxFileName::DirName( m_plotOpts.GetOutputDirectory() );
    wxString    boardFilename = m_parent->GetBoard()->GetFileName();

    m_reporter = &m_messagesPanel->Reporter();

    if( !EnsureFileDirectoryExists( &outputDir, boardFilename, m_reporter ) )
    {
        msg.Printf( _( "Could not write plot files to folder \"%s\"." ),
                    GetChars( outputDir.GetPath() ) );
        DisplayError( this, msg );
        return false;
    }

    fn = m_parent->GetBoard()->GetFileName();
    fn.SetPath( outputDir.GetPath() );

    // Create the the Front or Top side placement file,
    // or the single file
    int side = 1;

    if( singleFile )
    {
        side = 2;
        fn.SetName( fn.GetName() + wxT( "-" ) + wxT("all") );
    }
    else
        fn.SetName( fn.GetName() + wxT( "-" ) + frontSideName );

    fn.SetExt( FootprintPlaceFileExtension );

    fpcount = m_parent->DoGenFootprintsPositionFile( fn.GetFullPath(), UnitsMM(),
              ForceAllSmd(), side );
    if( fpcount < 0 )
    {
        msg.Printf( _( "Unable to create '%s'." ), GetChars( fn.GetFullPath() ) );
        wxMessageBox( msg );
        m_reporter->Report( msg, REPORTER::RPT_ERROR );
        return false;
    }

    if( singleFile  )
        msg.Printf( _( "Place file: '%s'." ), GetChars( fn.GetFullPath() ) );
    else
        msg.Printf( _( "Front side (top side) place file: '%s'." ),
                    GetChars( fn.GetFullPath() ) );
    m_reporter->Report( msg, REPORTER::RPT_INFO );

    msg.Printf( _( "Component count: %d." ), fpcount );
    m_reporter->Report( msg, REPORTER::RPT_INFO );

    if( singleFile  )
    {
        m_reporter->Report( _( "Componment Placement File generation OK." ), REPORTER::RPT_ACTION );
        return true;
    }

    // Create the Back or Bottom side placement file
    fullcount = fpcount;
    side = 0;
    fn = brd->GetFileName();
    fn.SetPath( outputDir.GetPath() );
    fn.SetName( fn.GetName() + wxT( "-" ) + backSideName );
    fn.SetExt( wxT( "pos" ) );

    fpcount = m_parent->DoGenFootprintsPositionFile( fn.GetFullPath(), UnitsMM(),
              ForceAllSmd(), side );

    if( fpcount < 0 )
    {
        msg.Printf( _( "Unable to create file '%s'." ), GetChars( fn.GetFullPath() ) );
        m_reporter->Report( msg, REPORTER::RPT_ERROR );
        wxMessageBox( msg );
        return false;
    }

    // Display results
    if( !singleFile )
    {
        msg.Printf( _( "Back side (bottom side) place file: '%s'." ), GetChars( fn.GetFullPath() ) );
        m_reporter->Report( msg, REPORTER::RPT_INFO );

//.........这里部分代码省略.........
开发者ID:BTR1,项目名称:kicad-source-mirror,代码行数:101,代码来源:gen_modules_placefile.cpp

示例2: CreateFiles

bool DIALOG_GEN_MODULE_POSITION::CreateFiles()
{
    BOARD * brd = m_parent->GetBoard();
    wxFileName  fn;
    wxString    msg;
    wxString    frontLayerName;
    wxString    backLayerName;
    bool singleFile = OneFileOnly();
    int fullcount = 0;

    // Count the footprints to place, do not yet create a file
    int fpcount = m_parent->DoGenFootprintsPositionFile( wxEmptyString, UnitsMM(),
                                                         ForceAllSmd(), 2 );
    if( fpcount == 0)
    {
        wxMessageBox( _( "No modules for automated placement." ) );
        return false;
    }

    fn = m_parent->GetBoard()->GetFileName();
    fn.SetPath( GetOutputDirectory() );
    frontLayerName = brd->GetLayerName( LAYER_N_FRONT );
    backLayerName = brd->GetLayerName( LAYER_N_BACK );

    // Create the the Front or Top side placement file,
    // or the single file
    int side = 1;

    if( singleFile )
    {
        side = 2;
        fn.SetName( fn.GetName() + wxT( "-" ) + wxT("all") );
    }
    else
        fn.SetName( fn.GetName() + wxT( "-" ) + frontLayerName );

    fn.SetExt( FootprintPlaceFileExtension );

    fpcount = m_parent->DoGenFootprintsPositionFile( fn.GetFullPath(), UnitsMM(),
                                                     ForceAllSmd(), side );
    if( fpcount < 0 )
    {
        msg.Printf( _( "Unable to create <%s>" ), GetChars( fn.GetFullPath() ) );
        AddMessage( msg + wxT("\n") );
        wxMessageBox( msg );
        return false;
    }

    if( singleFile  )
        msg.Printf( _( "Place file: <%s>\n" ), GetChars( fn.GetFullPath() ) );
    else
        msg.Printf( _( "Front side (top side) place file: <%s>\n" ),
                    GetChars( fn.GetFullPath() ) );

    AddMessage( msg );
    msg.Printf( _( "Footprint count %d\n" ), fpcount );
    AddMessage( msg );

    if( singleFile  )
        return true;

    // Create the Back or Bottom side placement file
    fullcount = fpcount;
    side = 0;
    fn = brd->GetFileName();
    fn.SetPath( GetOutputDirectory() );
    fn.SetName( fn.GetName() + wxT( "-" ) + backLayerName );
    fn.SetExt( wxT( "pos" ) );

    fpcount = m_parent->DoGenFootprintsPositionFile( fn.GetFullPath(), UnitsMM(),
                                                    ForceAllSmd(), side );

    if( fpcount < 0 )
    {
        msg.Printf( _( "Unable to create <%s>" ), GetChars( fn.GetFullPath() ) );
        AddMessage( msg + wxT("\n") );
        wxMessageBox( msg );
        return false;
    }

    // Display results
    if( !singleFile )
    {
        msg.Printf( _( "Back side (bottom side) place file: <%s>\n" ), GetChars( fn.GetFullPath() ) );
        AddMessage( msg );
        msg.Printf( _( "Footprint count %d\n" ), fpcount );
        AddMessage( msg );
    }

    if( !singleFile )
    {
        fullcount += fpcount;
        msg.Printf( _( "Full footprint count %d\n" ), fullcount );
        AddMessage( msg );
    }

    return true;
}
开发者ID:ianohara,项目名称:kicad-source-mirror,代码行数:98,代码来源:gen_modules_placefile.cpp


注:本文中的PCB_EDIT_FRAME::DoGenFootprintsPositionFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。