ATS_rout_redundant_line_removal.js 18.8 KB
Newer Older
Scott Sun's avatar
s  
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
/*
NAME: 
DESCRIPTION: 去除重复线;
PARAMETER:
	[
		{
			name : 'step',
			title : 'step',
			type : 'LineEdit',
			property : {tool_tip : '目标step,默认是orig'}
		},
		{
			name : 'auto_save',
			title : '自动保存',
			type : 'RadioBox',
			property : {
				item_list:[
					{name:'yes',text:'YES'},
					{name:'no',text:'NO'},
				],
				tool_tip:'是否自动保存料号开关'
			}
		}
	]
	
 VERSION_HISTORY:
	V1.00 2021-04-08 template
		1.新版本
		
 HELP:
	  <html><body bgcolor="#DDECFE">
		<font size="3" color="#003DB2"><p>功能简介</p></font>
		<p> template </ p>
		<br>
		<font size="3" color="#003DB2"><p>参数配置</p></font>
		<p> 去除重复线 </p>
		<br>
		<font size="3" color="#003DB2"><p>注意事项</p></font>
		<p> 无 </p>
		<br>
	</body></html>	
*/

// 引入模块 包 外部参数
var $ = require('topcam.scriptfunc').argv();
var fs = require('fs');
var _ = require('lodash');
var mode = $.ikm ? "topcam" : "aimdfm";
var IKM = $.ikm ? $.ikm : require('topcam.ikm6')($);
var GEN = $.gen;
var Job = $.job || $.job_name;
var JobId = $.job_id;
var db = $.db || IKM.db;
var plugin = require('topsin.gengui');
var GUI = plugin.newGui(plugin.__dirname);
var PAR = {};
if ($.par) {
	PAR = $.par;
} else if ($.hasOwnProperty('script_parameter')) {
	PAR = JSON.parse($.script_parameter);
}
if (mode === "aimdfm") {
	IKM.crud("updateRow", {
		table: "pdm_aimdfm_task",
		data: { current_process_title: $.process_title },
		where: { id: $.task_id }
	});
}
var Status = 'ok';
var resultData = [];
var par = PAR; // 接收参数
var default_par = { // 设置默认参数
	step: "cad",
	auto_save: "No",
Scott Sun's avatar
s  
Scott Sun committed
75
    workLayers:"rout",
Scott Sun's avatar
s  
Scott Sun committed
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
	units: "mm"
};
for (var key in default_par) {
	if (!par.hasOwnProperty(key) || par[key] == "") {
		par[key] = default_par[key];
	}
}

// 定义变量
var job = Job.toLowerCase();
require("topsin.genmath");
var genMath = new GenMath();
try {
	// 常规验证 准备工作
	if (!GEN.isJobExists({ job: job })) { throw "料号" + job + "不存在" }
	if (!GEN.isJobOpen({ job: job })) { GEN.openJob({ job: job }) }
	if (mode == "aimdfm") {
		if (GEN.checkInout({job: job,mode: "test"}) != 0) {
			throw "the job check"
		}
		GEN.checkInout({job: job,mode: "out"});
	}
	// 主体
	var stepList = GEN.getStepList({ job: job });
	stepList = stepList.filter(function (v) {
		var tmpreg = new RegExp(par.step, "ig");
		return tmpreg.test(v);
	});
	if (stepList.length == 0) {
		throw "未找到" + par.step
	}
    
Scott Sun's avatar
s  
Scott Sun committed
108 109 110 111 112
    // var workLayers = par.workLayers.split(";")
    // workLayers = workLayers.filter(function(l){return GEN.isLayerExists({job:job, layer:l})})
    // if(workLayers.length == 0) {
    //     throw "没有找到工作层"
    // }
Scott Sun's avatar
s  
Scott Sun committed
113

Scott Sun's avatar
s  
Scott Sun committed
114 115
	var workLayers = getWorkLayer()
	if (workLayers && workLayers.length > 0) {} else { throw "没有找到工作层"}
Scott Sun's avatar
s  
Scott Sun committed
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
	var func = 'function(props){return GUI.showForm({\
		title: "去除重复线",\
		size: "400x220",\
		use_core_engine: true,\
		include_hidden_items: true,\
		items: {\
			type: "ScrollArea",\
			property: {\
				widget_resizable: true,\
				frame_shape: "NoFrame"\
			},\
			child: [{\
				type: "FormGridLayout",\
				property: {\
				},\
				child: [{\
					name : "min_line",\
					title: "min_line",\
					type : "LineEdit",\
					property : {tool_tip : "min_line"}\
				},{\
					name : "max_line",\
					title: "max_line",\
					type : "LineEdit",\
					property : {tool_tip : "max_line"}\
				},{\
					name : "margin",\
					title: "margin",\
					type : "LineEdit",\
					property : {tool_tip : "margin"}\
				}]\
			}]\
		},\
Scott Sun's avatar
s  
Scott Sun committed
149
		values: { min_line: 0, max_line: 508,margin:-10 },\
Scott Sun's avatar
s  
Scott Sun committed
150
	}) }';
Scott Sun's avatar
s  
Scott Sun committed
151 152 153
	workLayers = workLayers.map(function (item) {
		return item.name
	});
Scott Sun's avatar
s  
Scott Sun committed
154
	var data = IKM.command(func, {}, 1).data;
Scott Sun's avatar
s  
Scott Sun committed
155
	if(data.hasOwnProperty("margin") && data.hasOwnProperty("max_line") && data.hasOwnProperty("min_line")) {
Scott Sun's avatar
s  
Scott Sun committed
156 157 158 159 160 161 162 163 164 165 166 167
		stepList.forEach(function (step) {
			GEN.openStep({ job: job, name: step });
			GEN.clearLayers();  //清除层显示
			GEN.affectedLayer({ mode: 'all', affected: 'no' }); //设置影响层全部不影响
			GEN.COM("sel_options,clear_mode=clear_after,display_mode=all_layers,area_inout=inside,area_select=select,select_mode=standard,area_touching_mode=exclude");
			GEN.units({ type: par.units }); //单位初始化
			GEN.zoomHome();  //窗口显示回到原始位置
			GEN.selClearFeature()
		
			GEN.affectedLayer({affected:"yes", layer:workLayers})
			GEN.COM("chklist_single,action=valor_dfm_nflr,show=yes")
			GEN.COM("chklist_cupd,chklist=valor_dfm_nflr,nact=1,params=((pp_layer=.affected)(pp_min_line="+data.min_line+")(pp_max_line="+data.max_line+")(pp_margin="+data.margin+")(pp_remove_item=Line\;Arc)(pp_delete=Covered)(pp_work=Features)(pp_remove_mark=Remove)),mode=regular")
Scott Sun's avatar
s  
Scott Sun committed
168 169 170 171 172
			GEN.COM("chklist_run,chklist=valor_dfm_nflr,nact=1,area=global")
			GEN.COM("chklist_single,action=valor_dfm_nflr,show=yes")
			GEN.COM("chklist_cupd,chklist=valor_dfm_nflr,nact=1,params=((pp_layer=.affected)(pp_min_line="+data.min_line+")(pp_max_line="+data.max_line+")(pp_margin="+data.margin+")(pp_remove_item=Line\;Arc)(pp_delete=Duplicated)(pp_work=Features)(pp_remove_mark=Remove)),mode=regular")
			GEN.COM("chklist_run,chklist=valor_dfm_nflr,nact=1,area=global")
			GEN.COM("chklist_close,chklist=valor_dfm_nflr,mode=hide")
Scott Sun's avatar
s  
Scott Sun committed
173
	
Scott Sun's avatar
s  
Scott Sun committed
174

Scott Sun's avatar
s  
Scott Sun committed
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473
			// workLayers.forEach(function (layer) {
			// 	check_connect_line_and_connnect({layer:layer,step:step})
			// })
			GEN.affectedLayer({ mode: 'all', affected: 'no' }); //设置影响层全部不影响
			GEN.clearLayers();  //清除层显示
		});
	}

	// 保存料号
	if (/yes/ig.test(par.auto_save)) {
		GEN.checkInout({ job: job, mode: "out" });
		GEN.saveJob({ job: job });
		GEN.checkInout({ job: job, mode: "in" });
	}

	// 结尾返回  固定写法
	var Return = "Done";
	if (mode === "aimdfm") {
		IKM.crud("updateRow", {
			table: "pdm_aimdfm_task",
			data: { progress: 100 },
			where: { id: $.task_id }
		});
		var tmperr = { type: "info", title: "操作完成, 请注意检查!" };
		if (GEN.hasError()) {
			Status = 'error';
			tmperr = { type: "error", title: "GEN错误!", detail: [{ desc: GEN.STATUS.join("\n") }] };
		}
		resultData.push(tmperr);
		Return = { status: Status, result_data: resultData };
	}
	return Return;
} catch (e) {
	var showGUI = true;
	if (GEN.STATUS.length > 0) {
		if (GEN.STATUS.indexOf("Pause Exit:0") >= 0) {
			showGUI = false;
		}
		e = _.toString(e) + "\n" + GEN.STATUS.join("\n");
	}
	if (showGUI) {
		IKM.msg(e);
	}
	Status = 'error';
	resultData.push({ type: "error", title: "脚本执行出错!", detail: [{ desc: _.toString(e) }] });
	return mode === "aimdfm" ? { status: Status, result_data: resultData } : "Error";
}

/**
 * 获取层别
 * @param {Object} 过滤选项
 * @returns {Array}
 */
function getLayer(props) {
	if (!props) {
		props = {};
	}
	var matrix = GEN.getMatrix({ job: job });
	return Object.keys(matrix).reduce(function (a, b) {
		var info = matrix[b];
		var ret = true;
		for (var _key in props) {
			if (info[_key]) {
				if (/object string|object number/ig.test({}.toString.call(props[_key]))) {
					if (props[_key] != info[_key]) {
						ret = false;
					}
				}
				if (/object RegExp/ig.test({}.toString.call(props[_key]))) {
					if (!props[_key].test(info[_key])) {
						ret = false;
					}
				}
				if (/object function/ig.test({}.toString.call(props[_key]))) {
					if (!props[_key](info[_key])) {
						ret = false;
					}
				}
			}
		}
		if (ret) {
			a.push(props.res == "info" ? info : b);
		}
		return a;
	}, []);
}



function check_connect_line_and_connnect(props){
    var step = props.step
    GEN.COM("disp_off");
    GEN.affectedLayer({affected:'yes',layer:props.layer,clear_before:'yes'});
    GEN.flattenLayer({source_layer:props.layer,target_layer:props.layer+'++tl++tmp++'});
//	GEN.selCopyOther(target_layer:props.layer.'++tl++tmp++',invert:'no');
    GEN.affectedLayer({affected:'yes',layer:props.layer+'++tl++tmp++',clear_before:'yes'});//当前工作层
	//1.去重复和cover 
	var check_list = 'topcam_tl_nflr_cover';
	if (GEN.isChklistExists({ job: job, step: step, chklist: check_list })) {
        GEN.COM("chklist_delete", { chklist: check_list });
    }

	var params={}
	var items=[];
	params.pp_layer = '.affected';
	params.pp_min_line = 0;
	params.pp_max_line = 2540;
	params.pp_margin = 25.4;
	params.pp_remove_item = 'Line\;Arc';
	params.pp_delete = 'Covered';
	params.pp_work = 'Features';
	params.pp_remove_mark = 'Remove';
	items.push({
		name:'tl_nflr_cover',
		nact:1,
		action:'valor_dfm_nflr',
		erf:'Report All (Mils)',
		params:params,
	})
	
	GEN.createChklist({chklist:check_list,items:items});            
	GEN.COM('chklist_run',{chklist:check_list,nact:1,area:'profile'});
	
	var check_list_ = 'topcam_tl_nflr_duplicated';
	if ( GEN.isChklistExists({job:Job,step:step,chklist:check_list_}) ){
		GEN.COM("chklist_delete",{chklist:check_list_});
	}
	var params_={}
	var items_=[];
	params_.pp_layer = '.affected';
	params_.pp_min_line = 0;
	params_.pp_max_line = 2540;
	params_.pp_margin = 25.4;
	params_.pp_remove_item = 'Line\;Arc';
	params_.pp_delete = 'Duplicated';
	params_.pp_work = 'Features';
	params_.pp_remove_mark = 'Remove';
	items_.push({
		name:'tl_nflr_duplicated',
		nact:1,
		action:'valor_dfm_nflr',
		erf:'Report All (Mils)',
		params:params_,
	})
	
	GEN.createChklist({chklist:check_list_,items:items_});            
	GEN.COM('chklist_run',{chklist:check_list_,nact:1,area:'profile'});
	
    GEN.selBreak();
    GEN.COM( "sel_design2rout,det_tol=10,con_tol=10,rad_tol=1" );//先修复一次 10mil内
    
    var feat = GEN.getFeatures({job:Job,step:step,layer:props.layer+'++tl++tmp++'});//抽取特殊槽
    if (GEN.isLayerExists({job:Job,layer:'tl++other++tmp++'})){
		GEN.deleteLayer({job:Job,layer:'tl++other++tmp++',step:step}) 
	};
	feat.forEach(function (tmp) {
		var size = tmp.symbol.slice(1) - 0;
        if (size >= 31.496) {
            GEN.COM('filter_reset',{filter_name:'popup'});
            GEN.selectByFilter({include_syms:tmp.symbol,profile:'all'});
            GEN.COM('filter_reset',{filter_name:'popup'});
            if ( GEN.getSelectCount() > 0 ){
				GEN.selMoveOther({target_layer:'tl++other++tmp++',invert:'no',dx:0,dy:0,size:0});
			}
        }
	})
  
    
    GEN.selChangeSym({symbol:'r1'});
    
    GEN.COM('profile_to_rout',{layer:'tl+wai++',width:0});
    GEN.affectedLayer({affected:'yes',layer:'tl+wai++',clear_before:'yes'});
    GEN.COM( "sel_cut_data,det_tol=1,con_tol=1,rad_tol=0.1,filter_overlaps=no,delete_doubles=no,use_order=yes,ignore_width=yes,ignore_holes=all,start_positive=yes,polarity_of_touching=same");
    
    GEN.affectedLayer({affected:'yes',layer:'tl+wai+++++',clear_before:'yes'});
    GEN.COM('sr_fill',{ polarity : 'positive', step_margin_x : 0, step_margin_y : 0, step_max_dist_x : 100, step_max_dist_y : 100, sr_margin_x : 0, sr_margin_y : 0, sr_max_dist_x : 0, sr_max_dist_y : 0, nest_sr : 'yes', stop_at_steps : '', consider_feat : 'no', consider_drill : 'no', consider_rout : 'no', dest : 'affected_layers', attributes : 'no'});
    GEN.COM('fill_params',{ type : 'solid', origin_type : 'datum', solid_type : 'fill', std_type : 'line', min_brush : 1, use_arcs : 'yes', symbol : '', dx : '0.1', dy : '0.1', x_off : 0, y_off : 0, std_angle : 45, std_line_width : 10, std_step_dist : 50, std_indent : 'odd', break_partial : 'yes', cut_prims : 'no', outline_draw : 'no', outline_width : 0, outline_invert : 'no'});
    GEN.COM('sel_fill');
    GEN.selContourize();
    GEN.selCopyOther({target_layer:'tl+wai++',invert:'yes'});//单只的suface
    GEN.affectedLayer({affected:'yes',layer:'tl+wai++',clear_before:'yes'});
    GEN.selContourize();
    GEN.COM('sel_resize', {size : -10, corner_ctl : 'no'});
    GEN.COM('sel_resize', {size : 20, corner_ctl : 'no'});
    GEN.COM('fill_params', {type : 'solid', origin_type : 'datum', solid_type : 'fill', std_type : 'line', min_brush : 1, use_arcs : 'yes', symbol : '', dx : '0.1', dy : '0.1', x_off : 0, y_off : 0, std_angle : 45, std_line_width : 10, std_step_dist : 50, std_indent : 'odd', break_partial : 'yes', cut_prims : 'no', outline_draw : 'no', outline_width : 0, outline_invert : 'no'});
    GEN.COM('sel_fill');
    GEN.selContourize();
    
    GEN.createLayer({job:Job,layer:'++profice++tmp++',context:'misc',type:'document',delete_exists:'yes'});
    GEN.affectedLayer({affected:'yes',layer:'++profice++tmp++',clear_before:'yes'});
    var profile = GEN.getProfileLimits({job:Job,step:step});
    GEN.addRectangle({x1:profile.xmin,y1:profile.ymin,x2:profile.xmax,y2:profile.ymax,type:'line',symbol:'r1'});
    
    GEN.affectedLayer({affected:'yes',layer:props.layer+'++tl++tmp++',clear_before:'yes'});//工作层
    GEN.selCopyOther({target_layer:'tl+wai+++++',invert:'yes'});
    GEN.affectedLayer({affected:'yes',layer:'tl+wai+++++',clear_before:'yes'});//工作层
    GEN.selContourize();
    GEN.COM('fill_params', {type : 'solid', origin_type : 'datum', solid_type : 'fill', std_type : 'line', min_brush : 1, use_arcs : 'yes', symbol : '', dx : '0.1', dy : '0.1', x_off : 0, y_off : 0, std_angle : 45, std_line_width : 10, std_step_dist : 50, std_indent : 'odd', break_partial : 'yes', cut_prims : 'no', outline_draw : 'no', outline_width : 0, outline_invert : 'no'});
    GEN.COM('sel_fill');
    GEN.selContourize();
    GEN.selRefFeat({layers:'++profice++tmp++',use:'filter',mode:'disjoint'});
    if ( GEN.getSelectCount() > 0 ){GEN.selDelete() };
    GEN.selRefFeat({layers:'tl+wai++',use:'filter',mode:'touch'});
    if ( GEN.getSelectCount() > 0 ){GEN.selDelete() };
    GEN.COM('sel_resize', {size : 10, corner_ctl : 'no'});
    GEN.selMoveOther({target_layer:'tl+wai++',invert:'no',dx:0,dy:0,size:1});
    
    GEN.affectedLayer({affected:'yes',layer:props.layer+'++tl++tmp++',clear_before:'yes'});
    GEN.selRefFeat({layers:'tl+wai++',use:'filter',mode:'cover'});
    if (GEN.getSelectCount() > 0){
        GEN.selRefFeat({layers:'tl+wai++',use:'select',mode:'touch'});
        if (GEN.getSelectCount() > 0){
            GEN.createLayer({job:Job,layer:'++tl+connect+line+',context:'misc',type:'document',delete_exists:'yes'});
            GEN.selMoveOther({target_layer:'++tl+connect+line+',invert:'no',dx:0,dy:0,size:0});
			 //2.检测连接点及重绘
			 var feat1 = GEN.getFeatures({job:Job,step:step,layer:'++tl+connect+line+'});//连接层数据
			 var feat2 = GEN.getFeatures({job:Job,step:step,layer:props.layer+'++tl++tmp++'});//被连接层数据
			 
			 //GEN.createLayer(job=>$Job,layer=>'+tmp++',context=>'misc',type=>'document',delete_exists=>'yes');//测试数据层
			 
			 feat1.forEach(function (tmp1) {
				 var line_tmp = [];
				 if (tmp1.type == 'line') {
					 var line1 = genMath.extend_line({xs:tmp1.xs,ys:tmp1.ys,xe:tmp1.xe,ye:tmp1.ye},0.3937);//
					 var line2 = genMath.extend_line({xs:line1.xe,ys:line1.ye,xe:line1.xs,ye:line1.ys},0.3937);
					 var line = {xs:line2.xe,ys:line2.ye,xe:line2.xs,ye:line2.ys};
					 
					 //GEN.workLayer(name=>'+tmp++',display_number=>1,clear_before=>'yes');
					 //GEN.addLine(xs=>$line->{xs},ys=>$line->{ys},xe=>$line->{xe},ye=>$line->{ye},symbol=>'r2');
					 feat2.forEach(function (tmp2) {
						 var line_x1 = line.xs < line.xe ? line.xs : line.xe;
						 var line_x2 = line.xs < line.xe ? line.xe : line.xs;
						 var line_y1 = line.ys < line.ye ? line.ys : line.ye;
						 var line_y2 = line.ys < line.ye ? line.ye : line.ys;
						 
						 var line2_x1 = tmp2.xs < tmp2.xe ? tmp2.xs : tmp2.xe;
						 var line2_x2 = tmp2.xs < tmp2.xe ? tmp2.xe : tmp2.xs;
						 var line2_y1 = tmp2.ys < tmp2.ye ? tmp2.ys : tmp2.ye;
						 var line2_y2 = tmp2.ys < tmp2.ye ? tmp2.ye : tmp2.ys;
						 
						 if((line2_x1 >= line_x1 && line2_x2 <= line_x2 && line2_y1 <= line_y1 && line2_y2 >= line_y2)
							 ||
							 (line2_x1 <= line_x1 && line2_x2 >= line_x2 && line2_y1 >= line_y1 && line2_y2 <= line_y2)){
								 var dis =  genMath.line2line_dist({xs:tmp1.xs,ys:tmp1.ys,xe:tmp1.xe,ye:tmp1.ye},
																		{xs:tmp2.xs,ys:tmp2.ys,xe:tmp2.xe,ye:tmp2.ye});
								 tmp2.distance = dis;
								 line_tmp.push(tmp2)
						 }
					 })
				 }
				 
				 //计算交点坐标 先冒泡排序一次
				 var add_line = [];
				 if (line_tmp.length > 1) {
					 for(var i = 0;i < line_tmp.length;i++){
						 for(var k = i + 1;k < line_tmp.length; k++){
							 if (line_tmp[k].distance < line_tmp[i].distance) {
								 var tmp;
								 tmp = line_tmp[i];
								 line_tmp[i] = line_tmp[k];
								 line_tmp[k] = tmp;
							 }
						 }
					 }
					 var i = 1;
					 for(var i=0;i < 2;i++){
						 add_line.push(
							 genMath.get_line_intersect({xs:tmp1.xs,ys:tmp1.ys,xe:tmp1.xe,ye:tmp1.ye},
								 {xs:line_tmp[i].xs,ys:line_tmp[i].ys,xe:line_tmp[i].xe,ye:line_tmp[i].ye},1)
						 )
					 }
				 }
				 
				 //GEN.workLayer(name=>$par{layer}.'++tl++tmp++',display_number=>1,clear_before=>'yes');
				 GEN.affectedLayer({affected:'yes',layer:props.layer+'++tl++tmp++',clear_before:'no'});
				 GEN.addLine({xs:add_line[0].x,ys:add_line[0].y,xe:add_line[1].x,ye:add_line[1].y,symbol:'r2',attributes:[{attribute:'.string',text:'tl_rou_line'}]});
			 });
        }
    }
    
   
    
    GEN.affectedLayer({affected:'yes',layer:props.layer+'++tl++tmp++',clear_before:'yes'});
    GEN.selChangeSym({symbol:'r10'});
    
    if (GEN.isLayerExists({job:Job,layer:'tl++other++tmp++'})){
        GEN.affectedLayer({affected:'yes',layer:'tl++other++tmp++',clear_before:'yes'});
        GEN.selMoveOther({target_layer:props.layer+'++tl++tmp++',invert:'no',dx:0,dy:0,size:0});
        GEN.deleteLayer({job:Job,layer:'tl++other++tmp++',step:step});
    }
    
    if (GEN.isLayerExists({job:Job,layer:'tl+wai++'})){
		GEN.deleteLayer({job:Job,layer:['tl+wai+++++','tl+wai++','++profice++tmp++','++tl+connect+line+'],step:step})
	};//删除临时层
	
	GEN.COM("disp_on");
	
	IKM.msg(props.layer+"层连接位修复完成请仔细检查!")
	GEN.PAUSE('Please Check!');
Scott Sun's avatar
s  
Scott Sun committed
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527
}

function getWorkLayer() {
	var matrix = GEN.getMatrix({ job: job });
	return GUI.selectLayer({
		title: "请选择层",
		//filter: ".*", // regular expression
		selectmode: "multiple", // single, multiple
		context: "all", // all, board, misc
		layertype: par.workLayers, // default type of layertypelist
		defaultsize: [600, 400], // window size
		layermatrix: matrix,
		layertypelist: [{
			name: "all",
			display_name: "All",
			filter: function filter(x) {
				return true;
			}
		}, {
			name: "outer",
			display_name: "Outer",
			filter: function filter(x) {
				return x.layer_type == "signal" && /top|bot/.test(x.side);
			}
		}, {
			name: "inner",
			display_name: "Inner",
			filter: function filter(x) {
				return (/signal|power_ground/.test(x.layer_type) && /inner/.test(x.side)
				);
			}
		}, {
			name: "solder_mask",
			display_name: "Solder Mask",
			filter: function filter(x) {
				return (/solder_mask/.test(x.layer_type)
				);
			}
		}, {
			name: "silk_screen",
			display_name: "Silk Screen",
			filter: function filter(x) {
				return (/silk_screen/.test(x.layer_type)
				);
			}
		}, {
			name: "rout",
			display_name: "Rout",
			filter: function filter(x) {
				return (/rout/.test(x.layer_type) || /outline/.test(x.name));
			}
		}],
		gen: GEN
	});
Scott Sun's avatar
s  
Scott Sun committed
528
}