生成网络信息.pl 2.96 KB
Newer Older
Scott Sun's avatar
Scott Sun committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
=head
 NAME: generate_ref_netlist
 DESCRIPTION: 产生参考netlist文件
 PARAMETER:
	{items => [
		{
			name=>'step_filter',
			label=>'Step过滤',
			type=>'string',
			must_field=>0,
			value => '',
			remark=>'选择step时候的过滤器',
		},
	]}
	
 VERSION_HISTORY:
    V1.00 2013-03-02 Tomy
		by require
		
 HELP:
	<html><body bgcolor="#DDECFE">
		<font size="3" color="#003DB2"><p>功能简介</p></font>
		  <p> </p>
		  <br>
		<font size="3" color="#003DB2"><p>参数配置</p></font>
		<font color="#008000"><p> ● step过滤</p></font>
		  <p> 选择step时候的过滤器</p>
		<font size="3" color="#003DB2"><p>注意事项</p></font>
		  <p> ● </p>
		  <br>
	</body></html>
  
=cut

#use strict;
#my ($JOB,$GEN,$GUI,$DB,$JOB_ID,$PAR);
use utf8;
use Encode;
use Data::Dump 'dump';
my ($Job,$Step);
my $Return = 'Done';

###处理step过滤
$Job = $JOB;
$PAR->{step_filter} = $PAR->{step_filter} ? $PAR->{step_filter} : '.*';


try{
	###检查Genesis料号是否存在并打开
	if (! $GEN->isJobExists(job=>$Job) ){
        $GUI->msgbox(-type=>'error',-text=>"料号 $Job 在Genesis中不存在, 请检查!");
        return 'Error';
    }
    $GEN->openJob(job=>$Job) unless ($GEN->isJobOpen(job=>$Job));
	
	###check and get work Step name 
    my @steps =  $GEN->getStepList(job=>$Job);
	if ( @steps == 0 ) {
		$GUI->msgbox(-icon=>'error',-text=>'在料号中没有Step存在,你将退出!');
		return 0;
	}
	elsif (@steps != 1){
        my @tmp_steps = grep(/$PAR->{step_filter}/,@steps);
        if ( @tmp_steps == 1 ) {
            $Step = $tmp_steps[0];
        }
        else {
            $Step = $GUI->select_step(-title=>'请选择工作Step',
                                      -steplist=>[@tmp_steps],
                                      -selectmode=>'single');
            return 'Cancel' unless ($Step);            
        }
	}
    else {
        $Step = $steps[0];
    }
    
    ###Open step and clear layer
    $GEN->openStep(job=>$Job,name=>$Step);
    $GEN->clearLayers();
    $GEN->affectedLayer(mode=>'all',affected=>'no');
    $GEN->units(type=>'inch');
    
    $GEN->COM('netlist_page_open',set=>'yes',job1=>$Job,step1=>$Step,type1=>'cur',job2=>$Job,step2=>$Step,type2=>'cur');
	$GEN->COM('netlist_recalc',job=>$Job,step=>$Step,type=>'cur',display=>'top');
	$GEN->COM('netlist_ref_update',job=>$Job,step=>$Step,source=>'cur',reduce=>'yes');
    $GEN->COM('netlist_page_close');
    
	$Return = 'Finish';
	
	$GUI->msgbox(-text=>"参考网络产生成功");
	
	###output and return status, if genesis error, it will output genesis error command
	unless ($GEN->{STATUS}){
		return $Return;
	}
	else{
		$GUI->msgbox(-icon=>'error',-text=>join("\n",@{$GEN->{STATUS}}));
		addFlowNotes(-notes=>"   Genesis Error:\n   ".join("\n   ",@{$GEN->{STATUS}}));
		return 'Error';
	}
}
catch Error::Simple with {
	my $error = encode("utf8",shift);
	$GUI->msgbox(-icon=>'error',-text=>$error);
	return 'Error';
}
finally{
	#_deleteLayer(layer=>[$TmpLayer]);
	$GEN->units(type=>'mm');
};

__END__