注册会员会员登录

当前位置:首页 > 脚本学习资料 > Perl/Tk

Perl常用语句的整理(二)

发布时间:2016-12-27 19:15:00 点击:
##################################################################
#get sr limits.
sub get_sr_limits{
shift;
    my ($job_name, $step_name) = @_;

    my @sr_list;
    $f->DO_INFO("-t step -e $job_name/$step_name -d SR_LIMITS");
    my $xmin = $f->{doinfo}{gSR_LIMITSxmin};
    my $xmax = $f->{doinfo}{gSR_LIMITSxmax};
    my $ymin = $f->{doinfo}{gSR_LIMITSymin};
    my $ymax = $f->{doinfo}{gSR_LIMITSymax};
    my $xsize = $xmax - $xmin;
    my $ysize = $ymax - $ymin;
    push(@sr_list,$xmin,$xmax,$ymin,$ymax,$xsize,$ysize);
    return(@sr_list);
}

##################################################################
#get silk list.
sub get_silk_list {
shift;
    my ($job_name) = @_;
    $f->DO_INFO("-t MATRIX -d ROW -e $job_name/matrix");
    my $info_ref;
    my @silk_array =   ();
 
    for(my $i=0 ; $i < @{$f->{doinfo}{gROWname}} ; $i++){
        $info_ref = { name       => @{$f->{doinfo}{gROWname}}[$i],
                      layer_type => @{$f->{doinfo}{gROWlayer_type}}[$i],
                      context    => @{$f->{doinfo}{gROWcontext}}[$i],
                      polarity   => @{$f->{doinfo}{gROWpolarity}}[$i],
                      side       => @{$f->{doinfo}{gROWside}}[$i],
                    };

        if ( $info_ref->{context} eq "board" && $info_ref->{layer_type} eq "silk_screen" ){
            push(@silk_array,$info_ref->{name});
        }
    }
    return(@silk_array);
}
##################################################################
#get solder mask list.
sub get_sm_list {
    shift;
    my ($job_name) = @_;
    $f->DO_INFO("-t MATRIX -d ROW -e $job_name/matrix");
    my $info_ref;
    my @sm_array =   ();
 
    for(my $i=0 ; $i < @{$f->{doinfo}{gROWname}} ; $i++){
        $info_ref = { name       => @{$f->{doinfo}{gROWname}}[$i],
                      layer_type => @{$f->{doinfo}{gROWlayer_type}}[$i],
                      context    => @{$f->{doinfo}{gROWcontext}}[$i],
                      polarity   => @{$f->{doinfo}{gROWpolarity}}[$i],
                      side       => @{$f->{doinfo}{gROWside}}[$i],
                    };

        if ( $info_ref->{context} eq "board" && $info_ref->{layer_type} eq "solder_mask" ){
            push(@sm_array,$info_ref->{name});
        }
    }
    return(@sm_array);
}
##################################################################
#get signal list.
sub get_signal_list {
    shift;
    my ($job_name) = @_;
    $f->DO_INFO("-t MATRIX -d ROW -e $job_name/matrix");
    my $info_ref;
    my @signal_array =   ();
 
    for(my $i=0 ; $i < @{$f->{doinfo}{gROWname}} ; $i++){
        $info_ref = { name       => @{$f->{doinfo}{gROWname}}[$i],
                      layer_type => @{$f->{doinfo}{gROWlayer_type}}[$i],
                      context    => @{$f->{doinfo}{gROWcontext}}[$i],
                      polarity   => @{$f->{doinfo}{gROWpolarity}}[$i],
                      side       => @{$f->{doinfo}{gROWside}}[$i],
                    };

        if ( $info_ref->{context} eq "board" && $info_ref->{layer_type} =~ /(signal|power_ground)/ ){
            push(@signal_array,$info_ref->{name});
        }
    }
    return(@signal_array);
}
##################################################################
#get drill list.
sub get_drill_list {
    shift;
    my ($job_name) = @_;
    $f->DO_INFO("-t MATRIX -d ROW -e $job_name/matrix");
    my $info_ref;
    my @drill_array =   ();
 
    for(my $i=0 ; $i < @{$f->{doinfo}{gROWname}} ; $i++){
        $info_ref = { name       => @{$f->{doinfo}{gROWname}}[$i],
                      layer_type => @{$f->{doinfo}{gROWlayer_type}}[$i],
                      context    => @{$f->{doinfo}{gROWcontext}}[$i],
                      polarity   => @{$f->{doinfo}{gROWpolarity}}[$i],
                      side       => @{$f->{doinfo}{gROWside}}[$i],
                    };

        if ( $info_ref->{context} eq "board" && $info_ref->{layer_type} eq "drill" ){
            push(@drill_array,$info_ref->{name});
        }
    }
    return(@drill_array);
}
##################################################################
#get rout list.
sub get_rout_list {
    shift;
    my ($job_name) = @_;
    $f->DO_INFO("-t MATRIX -d ROW -e $job_name/matrix");
    my $info_ref;
    my @rout_array =   ();
 
    for(my $i=0 ; $i < @{$f->{doinfo}{gROWname}} ; $i++){
        $info_ref = { name       => @{$f->{doinfo}{gROWname}}[$i],
                      layer_type => @{$f->{doinfo}{gROWlayer_type}}[$i],
                      context    => @{$f->{doinfo}{gROWcontext}}[$i],
                      polarity   => @{$f->{doinfo}{gROWpolarity}}[$i],
                      side       => @{$f->{doinfo}{gROWside}}[$i],
                    };

        if ( $info_ref->{context} eq "board" && $info_ref->{layer_type} eq "rout" ){
            push(@rout_array,$info_ref->{name});
        }
    }
    return(@rout_array);
}

##################################################################
#messages.
sub messages{
    shift;
    my ($mw,$message)=@_;
    my $result = $mw->messageBox(-title =>"messages",
                                                         -message =>"$message",
                                                         -type =>'yesno',
                                                         -icon =>'question',
                                                         -default =>'yes');
    return $result;
}
##################################################################
#dialog.
sub dialog{
    shift;
    my ($mw,$message)=@_;
    $mw->Dialog(-title=>'Dialog',
                          -text =>"$message",
                          -default_button => 'Ok',
                          -buttons => ['Ok'],
                          -bitmap => 'error')->Show();
}
##################################################################
__END__

    文章评论
    内容:
     
    惠州韦达软件技术服务有限公司:
    电话:15728891693 /18688300180 邮箱:2933839366@qq.com QQ: 2933839366 网址:www.qhscript.com