UNPKG

@typecad/typecad

Version:

🤖programmatically 💥create 🛰️hardware

1 lines 5.23 kB
import a20_0x1342ec from'chalk';import{generateUuid}from'./pcb_utils';export function zone(_0x82767a,_0x58f8d7){const {pin:_0xab5688,net:_0x232de8,layers:_0x2c6271,x:_0x2cdfbc,y:_0x2c3ff5,width:_0x55aa05,height:_0x1c3d19,fillMode:fillMode='solid',filled:filled=!![],priority:priority=0x0,locked:locked=![],name:_0x3f929f,minThickness:minThickness=0.1778,hatchStyle:hatchStyle=_0x4e088f(0x70,0x71),hatchPitch:hatchPitch=0.508,clearance:clearance=0.2,connectPads:_0x10a0cc,thermalGap:thermalGap=0.254,thermalBridgeWidth:thermalBridgeWidth=0.4064,smoothing:_0x1b2fcd,smoothingRadius:_0x5827d1,islandRemovalMode:_0x58b863,islandAreaMin:_0x49a51a,hatchThickness:_0x441c2a,hatchGap:_0x58e9f7,hatchOrientation:_0x10703a,hatchSmoothingLevel:_0x5ae175,hatchSmoothingValue:_0x302513,hatchBorderAlgorithm:_0x29e41f,hatchMinHoleArea:_0x23d44f,fillArcSegments:fillArcSegments=0x10,filledAreasThickness:_0x54723a}=_0x58f8d7;if(!_0xab5688&&!_0x232de8){const _0x3e793e=_0x82767a['getCallSite'](),_0x398ec5=_0x3e793e?_0x4e088f(0x71,0x73)+_0x3e793e['file']+':'+_0x3e793e['line']+')':'';console[_0x4e088f(0x72,0x71)](a20_0x1342ec['red']('[PCB\x20ZONE]\x20ERROR:\x20Must\x20provide\x20either\x20\x27pin\x27\x20or\x20\x27net\x27\x20parameter'+_0x398ec5));return;}if(_0xab5688&&_0x232de8){const _0x3e9ba4=_0x82767a['getCallSite'](),_0x5e3ec4=_0x3e9ba4?'\x20(called\x20from\x20'+_0x3e9ba4['file']+':'+_0x3e9ba4['line']+')':'';console['error'](a20_0x1342ec['red']('[PCB\x20ZONE]\x20ERROR:\x20Cannot\x20provide\x20both\x20\x27pin\x27\x20and\x20\x27net\x27\x20parameters.\x20Use\x20one\x20or\x20the\x20other'+_0x5e3ec4));return;}const _0x500140=[{'x':_0x2cdfbc,'y':_0x2c3ff5},{'x':_0x2cdfbc+_0x55aa05,'y':_0x2c3ff5},{'x':_0x2cdfbc+_0x55aa05,'y':_0x2c3ff5+_0x1c3d19},{'x':_0x2cdfbc,'y':_0x2c3ff5+_0x1c3d19}];function _0x4e088f(_0x114b73,_0x585f0a){return a20_0x5c1c(_0x114b73-0x70,_0x585f0a);}const _0xf02646=generateUuid();let _0x520916;if(_0xab5688)_0x520916='pin:'+_0xab5688['reference']+':'+_0xab5688['number'];else _0x232de8&&(_0x520916='net:'+_0x232de8);const _0x271241={'uuid':_0xf02646,'layers':_0x2c6271,'x':_0x2cdfbc,'y':_0x2c3ff5,'width':_0x55aa05,'height':_0x1c3d19,'polygon':_0x500140,'net':_0x520916,'fillMode':fillMode,'filled':filled,'priority':priority,'locked':locked,'name':_0x3f929f,'minThickness':minThickness,'hatchStyle':hatchStyle,'hatchPitch':hatchPitch,'clearance':clearance,'connectPads':_0x10a0cc,'thermalGap':thermalGap,'thermalBridgeWidth':thermalBridgeWidth,'smoothing':_0x1b2fcd,'smoothingRadius':_0x5827d1,'islandRemovalMode':_0x58b863,'islandAreaMin':_0x49a51a,'hatchThickness':_0x441c2a,'hatchGap':_0x58e9f7,'hatchOrientation':_0x10703a,'hatchSmoothingLevel':_0x5ae175,'hatchSmoothingValue':_0x302513,'hatchBorderAlgorithm':_0x29e41f,'hatchMinHoleArea':_0x23d44f,'fillArcSegments':fillArcSegments,'filledAreasThickness':_0x54723a};_0x82767a['zones']['push'](_0x271241);}export function keepout(_0x58e9f8,_0x347060){const {layers:_0x382823,x:_0x694bbd,y:_0x3b5c7b,width:_0xaebe19,height:_0x1246dc,restrictions:restrictions={},priority:priority=0x0,locked:locked=![],name:_0x4a5b19,hatchStyle:hatchStyle='edge',hatchPitch:hatchPitch=0.508,smoothing:_0x50a17d,smoothingRadius:_0x2a8fbe}=_0x347060,_0x5833d6=[{'x':_0x694bbd,'y':_0x3b5c7b},{'x':_0x694bbd+_0xaebe19,'y':_0x3b5c7b},{'x':_0x694bbd+_0xaebe19,'y':_0x3b5c7b+_0x1246dc},{'x':_0x694bbd,'y':_0x3b5c7b+_0x1246dc}],_0x3d8498=generateUuid(),_0x53a356={'uuid':_0x3d8498,'layers':_0x382823,'x':_0x694bbd,'y':_0x3b5c7b,'width':_0xaebe19,'height':_0x1246dc,'polygon':_0x5833d6,'priority':priority,'locked':locked,'name':_0x4a5b19,'restrictions':{'tracks':restrictions['tracks']!==![],'vias':restrictions['vias']!==![],'pads':restrictions['pads']!==![],'copperpour':restrictions['copperpour']!==![],'footprints':restrictions['footprints']!==![]},'hatchStyle':hatchStyle,'hatchPitch':hatchPitch,'smoothing':_0x50a17d,'smoothingRadius':_0x2a8fbe};_0x58e9f8['keepoutZones']['push'](_0x53a356);}function a20_0x2336(){const _0x4e1523=['edge','\x20(called\x20from\x20','error','uuid','blue','[PCB]\x20Removed\x20','stagedOutlines','length'];a20_0x2336=function(){return _0x4e1523;};return a20_0x2336();}export function _getStagedOutlines(_0x577036){return _0x577036['stagedOutlines'];}function a20_0x5c1c(_0x2336b9,_0x5c1c76){const _0x4319d6=a20_0x2336();return a20_0x5c1c=function(_0x21aedd,_0x15ece6){_0x21aedd=_0x21aedd-0x0;let _0x14cdf7=_0x4319d6[_0x21aedd];return _0x14cdf7;},a20_0x5c1c(_0x2336b9,_0x5c1c76);}export function _removeStagedOutlinesByUuid(_0x5c3733,_0x3685c6){function _0xa1f20c(_0x27e41f,_0x3c9cc8){return a20_0x5c1c(_0x27e41f-0x36d,_0x3c9cc8);}const _0x5067d6=new Set(_0x3685c6),_0x1a35e9=_0x5c3733['stagedOutlines']['length'];_0x5c3733['stagedOutlines']=_0x5c3733['stagedOutlines']['filter'](_0x38d30e=>{const _0x204b6f=_0x38d30e['elements']['some'](_0x4e0edd=>'uuid'in _0x4e0edd&&_0x5067d6['has'](_0x4e0edd[_0x137ac5(-0xf6,-0xf7)]));function _0x137ac5(_0x444b87,_0x1d7e73){return a20_0x5c1c(_0x444b87- -0xf9,_0x1d7e73);}return!_0x204b6f;}),console['log'](a20_0x1342ec[_0xa1f20c(0x371,0x374)](_0xa1f20c(0x372,0x370)+(_0x1a35e9-_0x5c3733[_0xa1f20c(0x373,0x377)][_0xa1f20c(0x374,0x373)])+'\x20staged\x20outline(s)\x20with\x20'+_0x3685c6['length']+'\x20UUID(s)'));}