对 因为感觉这个脚本不需要拐弯 都是直线 可以参考一下这个脚本 是点击一下的。 
 
procedure( ConnectNetByName() let(         (Obj1sObj2s  Obj1  Obj2 Ob1Name           Point1 Point2 Point3 Point4 PX1 PX2  PX3 PX4         PY1 PY2 PY3 PY4 Space1 Space2 Space3Space4  TechFile CGroupId MyViaOptions         point_LD_xpoint_LU_x point_RD_x point_RU_x point_LD_y point_LU_y point_RD_y point_RU_y         Window Ob2W Ob1W LeftDown LeftUp RightUp RightDown     ) geSelectBy2PointsLine() Obj1s=geGetSelSet() geSelectBy2PointsLine() Obj2s=geGetSelSet()   procedure(FlipPathSeg(pSeg)   dbSetPathSegPoints(pSeg pSeg~>endPtpSeg~>beginPt) pSeg ; ); point_LD_x = nil point_LU_x = nil point_RD_x = nil point_RU_x = nil point_LD_y = nil point_LU_y = nil point_RD_y = nil point_RU_y = nil foreach(OBJ1x Obj1s cond( (OBJ1x~>objType!="pathSeg"  Obj1= car(leConvertShapeToPathSeg(OBJ1x))); (OBJ1x~>objType=="pathSeg"  if((xCoord(OBJ1x~>beginPt)==xCoord(OBJ1x~>endPt) &&yCoord(OBJ1x~>beginPt)>yCoord(OBJ1x~>endPt))    ||(yCoord(OBJ1x~>beginPt)==yCoord(OBJ1x~>endPt) &&xCoord(OBJ1x~>beginPt)>xCoord(OBJ1x~>endPt))  thenprintln("Flip") Obj1 = FlipPathSeg(OBJ1x)   elseObj1 = OBJ1x   );if  );  );cond Ob1Name = Obj1~>net~>name Ob1W = Obj1~>width/2 ;printf("Mark0:%L \n" Ob1Name) foreach(OBJ2x Obj2s if(OBJ2x~>net~>name==Ob1Name then ;printf("Mark1:%L \n"OBJ2x~>net~>name)   cond( (OBJ2x~>objType!="pathSeg"  Obj2= car(leConvertShapeToPathSeg(OBJ2x))); (OBJ2x~>objType=="pathSeg"  if((xCoord(OBJ2x~>beginPt)==xCoord(OBJ2x~>endPt)&&yCoord(OBJ2x~>beginPt)>yCoord(OBJ2x~>endPt))   ||(yCoord(OBJ2x~>beginPt)==yCoord(OBJ2x~>endPt) &&xCoord(OBJ2x~>beginPt)>xCoord(OBJ2x~>endPt))  thenObj2 = FlipPathSeg(OBJ2x)  elseObj2 = OBJ2x   );if  );  );cond     Ob2W = Obj2~>width/2 Point1 = Obj1~>beginPt Point2 =Obj1~>endPt Point3 = Obj2~>beginPt Point4 =Obj2~>endPt PX1 = xCoord(Point1)  PY1 = yCoord(Point1) PX2 = xCoord(Point2)  PY2 = yCoord(Point2) PX3 = xCoord(Point3)  PY3 = yCoord(Point3) PX4 = xCoord(Point4)  PY4 = yCoord(Point4) Space1 = expt((PX1-PX3) 2) + expt((PY1 -PY3) 2) Space2 = expt((PX1-PX4) 2) + expt((PY1 -PY4) 2) Space3 = expt((PX2-PX3) 2) + expt((PY2 -PY3) 2) Space4 = expt((PX2-PX4) 2) + expt((PY2 -PY4) 2) if((PX1==PX2)&& (PY3==PY4) then ;NearPt = list(PX1 PY3)     LeftDown = list(PX1-Ob1W PY3-Ob2W) LeftUp = list(PX1-Ob1W PY3+Ob2W)     RightDown = list(PX1+Ob1W PY3-Ob2W) RightUp= list(PX1+Ob1W PY3+Ob2W) if(min(Space1 Space2 Space3 Space4) ==Space1 then dbSetPathSegPoints(Obj1  list(PX1 PY3-Ob2W) Point2)     dbSetPathSegPoints(Obj2 list(PX1-Ob1W PY3) Point4) );if if(min(Space1 Space2 Space3 Space4) ==Space2 then dbSetPathSegPoints(Obj1 list(PX1PY3-Ob2W) Point2)     dbSetPathSegPoints(Obj2 Point3 list(PX1+Ob1W PY3)) );if if(min(Space1 Space2 Space3 Space4) ==Space3 then dbSetPathSegPoints(Obj1  Point1 list(PX1 PY3+Ob2W))     dbSetPathSegPoints(Obj2 list(PX1-Ob1W PY3) Point4) );if if(min(Space1 Space2 Space3 Space4) ==Space4 then dbSetPathSegPoints(Obj1  Point1 list(PX1 PY3+Ob2W))     dbSetPathSegPoints(Obj2  Point3list(PX1+Ob1W PY3)) ) )     if((PY1==PY2) && (PX3==PX4) then ;NearPt = list(PX3 PY1)     LeftDown = list(PX3-Ob2W PY1-Ob1W) LeftUp = list(PX3-Ob2W PY1+Ob1W)     RightDown= list(PX3+Ob2W PY1-Ob1W) RightUp= list(PX3+Ob2W PY1+Ob1W) if(min(Space1 Space2 Space3 Space4) ==Space1 then dbSetPathSegPoints(Obj1  list(PX3-Ob2W PY1) Point2)     dbSetPathSegPoints(Obj2  list(PX3PY1-Ob1W) Point4) );if if(min(Space1 Space2 Space3 Space4) ==Space2 then ;dbSetPathSegStyle(Obj1 car(OS1)"truncate" caddr(OS1) cdddr(OS1))     dbSetPathSegPoints(Obj1 list(PX3-Ob2W PY1) Point2)     dbSetPathSegPoints(Obj2 Point3 list(PX3 PY1+Ob1W)) );if if(min(Space1 Space2 Space3 Space4) ==Space3 then ;dbSetPathSegStyle(Obj1 car(OS1) cadr(OS1)"truncate"  cdddr(OS1))     dbSetPathSegPoints(Obj1  Point1list(PX3+Ob2W PY1))     dbSetPathSegPoints(Obj2  list(PX3PY1-Ob1W) Point4) );if if(min(Space1 Space2 Space3 Space4) ==Space4 then ;dbSetPathSegStyle(Obj1 car(OS1)cadr(OS1) "truncate" cdddr(OS1))     dbSetPathSegPoints(Obj1  Point1list(PX3+Ob2W PY1))     dbSetPathSegPoints(Obj2  Point3list(PX3 PY1+Ob1W)) )) ) )   point_LD_x = cons( xCoord(LeftDown) point_LD_x)   point_LU_x = cons(xCoord(LeftUp) point_LU_x)   point_RD_x = cons(xCoord(RightDown) point_RD_x)   point_RU_x = cons(xCoord(RightUp) point_RU_x)   point_LD_y = cons(yCoord(LeftDown) point_LD_y)   point_LU_y = cons(yCoord(LeftUp) point_LU_y)   point_RD_y = cons(yCoord(RightDown) point_RD_y)   point_RU_y = cons(yCoord(RightUp) point_RU_y)   ) LeftDown = list(apply('min point_LD_x)apply('min point_LD_y))   LeftUp = list(apply('min point_LD_x)apply('max point_LU_y))   RightUp = list(apply('max point_RU_x)apply('max point_LU_y))   RightDown = list(apply('max point_RU_x)apply('min point_RD_y))   println(RightDown)                         /******************************************************************************/     TechFile = techGetTechFile(geGetEditRep()) CGroupId =cstFindConstraintGroupIn(TechFile "virtuosoDefaultSetup") MyViaOptions = viaGetViaOptions(CGroupId) MyViaOptions~>automatic~>minNumCuts=2 MyViaOptions~>automatic~>preventDRCWithNeighbors= t MyViaOptions~>automatic~>cutBBoxOrientation= "auto" MyViaOptions~>automatic~>viaAlignment= "auto" MyViaOptions~>automatic~>connectShapesOnSameNet=t Window = deGetCellView() viaGenerateViasInArea(Window list(LeftDownLeftUp RightUp RightDown)  MyViaOptions)            TechFile = techGetTechFile(geGetEditRep())        CGroupId = cstFindConstraintGroupIn(TechFile"virtuosoDefaultSetup")        MyViaOptions = viaGetViaOptions(CGroupId)        MyViaOptions~>automatic~>minNumCuts= 2        MyViaOptions~>automatic~>preventDRCWithNeighbors = t        MyViaOptions~>automatic~>connectShapesOnSameNet=t        MyViaOptions~>automatic~>cutBBoxOrientation= "horizontal"        MyViaOptions~>automatic~>viaAlignment = "centerLeft" ||"centerRight"        viaGenerateViasInArea(Window list(LeftDown LeftUp RightUp RightDown)MyViaOptions)          TechFile = techGetTechFile(geGetEditRep())        CGroupId = cstFindConstraintGroupIn(TechFile"virtuosoDefaultSetup")        MyViaOptions = viaGetViaOptions(CGroupId)        MyViaOptions~>automatic~>minNumCuts= 2        MyViaOptions~>automatic~>preventDRCWithNeighbors = t         MyViaOptions~>automatic~>connectShapesOnSameNet=t        MyViaOptions~>automatic~>cutBBoxOrientation= "vertical"        MyViaOptions~>automatic~>viaAlignment = "lowerCenter" ||"upperCenter"        viaGenerateViasInArea(Window list(LeftDown LeftUp RightUp RightDown)MyViaOptions)          TechFile= techGetTechFile(geGetEditRep())        CGroupId = cstFindConstraintGroupIn(TechFile"virtuosoDefaultSetup")        MyViaOptions = viaGetViaOptions(CGroupId)        MyViaOptions~>automatic~>minNumCuts= 2        MyViaOptions~>automatic~>preventDRCWithNeighbors = t        MyViaOptions~>automatic~>connectShapesOnSameNet=t        MyViaOptions~>automatic~>cutBBoxOrientation ="horizontal"        MyViaOptions~>automatic~>viaAlignment = "centerRight" ||"centerLeft"        viaGenerateViasInArea(Window list(LeftDown LeftUp RightUp RightDown)MyViaOptions)            TechFile = techGetTechFile(geGetEditRep())        CGroupId = cstFindConstraintGroupIn(TechFile"virtuosoDefaultSetup")        MyViaOptions = viaGetViaOptions(CGroupId)        MyViaOptions~>automatic~>minNumCuts= 2        MyViaOptions~>automatic~>connectShapesOnSameNet=t        MyViaOptions~>automatic~>preventDRCWithNeighbors = t        MyViaOptions~>automatic~>cutBBoxOrientation = "vertical"        MyViaOptions~>automatic~>viaAlignment = "centerCenter"        viaGenerateViasInArea(Window list(LeftDown LeftUp RightUp RightDown)MyViaOptions)                TechFile= techGetTechFile(geGetEditRep())        CGroupId = cstFindConstraintGroupIn(TechFile "virtuosoDefaultSetup")        MyViaOptions = viaGetViaOptions(CGroupId)        MyViaOptions~>automatic~>minNumCuts= 2        MyViaOptions~>automatic~>connectShapesOnSameNet=t        MyViaOptions~>automatic~>preventDRCWithNeighbors = t        MyViaOptions~>automatic~>cutBBoxOrientation ="horizontal"        MyViaOptions~>automatic~>viaAlignment = "centerCenter"        viaGenerateViasInArea(Window list(LeftDown LeftUp RightUp RightDown)MyViaOptions)            TechFile= techGetTechFile(geGetEditRep())        CGroupId = cstFindConstraintGroupIn(TechFile"virtuosoDefaultSetup")        MyViaOptions = viaGetViaOptions(CGroupId)        MyViaOptions~>automatic~>minNumCuts= 1        MyViaOptions~>automatic~>connectShapesOnSameNet=t        MyViaOptions~>automatic~>preventDRCWithNeighbors = t        MyViaOptions~>automatic~>cutBBoxOrientation = "vertical"        MyViaOptions~>automatic~>viaAlignment = "centerCenter"        viaGenerateViasInArea(Window list(LeftDown LeftUp RightUp RightDown)MyViaOptions)     ) ;let );pro /*procedure(MetalLayerNumber(MetalLayerName ) let(( MetalList MetalNum) MetalList=list("ME1""VI1" "ME2" "VI2" "ME3" "VI3""ME4" "VI4" "ME5" "VI5" "ME6""VI6" "ME7" "VI7" ) for(i 1 length(MetalList) if(nth(i-1 MetalList)== MetalLayerName then MetalNum=i);if );for MetalNum );let   );proc */ hiSetBindKey("Layout""Shift<Key>8" "ConnectNetByName()")   ;partial select two parts lines, one partis horizontal, another part is vertical, ;then runswCreateVias("horizontal" )/swCreateVias ("vertical"), ;hozizontal/vertical vias will be createdand related nets will shorten. ;Orientation is a member of list("auto" "horizontal" "vertical") procedure(swCreateVias(Orientation) let((cv objs tf nets Hnets Vnets firHselDirfirVselDir len HnetId Hw HselDir HselPtCoord selFigPt HnetLayerName VnetId Vw VselDirVselPtCoord VselFigPt VnetL ayerName Hstretch Vstretch viaLoca autoViaL cstGrpIdviaOpt ions  HnetGrp  HselFigPt VnetGrp VnetLayerName viaOptions)        cv=geGetEditCellView()        objs=geGetSelSet()        tf=ciGetTechFile()        nets=setof(iobjs i~>objType=="path"||i~>objType=="pathSeg")        Hnets=setof(inets swNetInfo(i)~>netDir=="Horizontal")        Hnets=sort(Hnetslambda((a b)                             yCoord(swNetInfo(a)~>selPtCoord)>yCoord(swNetInfo(b)~>selPtCoord)))        Vnets=setof(inets swNetInfo(i)~>netDir=="Vertical")        Vnets=sort(Vnetslambda((a b)                             xCoord(swNetInfo(a)~>selPtCoord)<xCoord(swNetInfo(b)~>selPtCoord)))        if(!Hnets||!Vnetsthen ;only select Hnets or Vnets, output error message               error("\nPleasepartial select at least one vertical net and one horizontal net!!!"));if        firHselDir=swNetInfo(car(Hnets))~>selDir        firVselDir=swNetInfo(car(Vnets))~>selDir        cond(    (firHselDir=="Right"&&firVselDir=="Up"          Hnets=reverse(Hnets))               (firHselDir=="Left"&&firVselDir=="Down"       Vnets=reverse(Vnets))               (firHselDir=="Left"&&firVselDir=="Up"            Hnets=reverse(Hnets)Vnets=reverse(Vnets))   );cond               ;makesure create vias from inside to outside        len=min(length(Hnets)length(Vnets))          for(i1 len        HnetId=nth(i-1Hnets)        Hw=HnetId~>width        HselDir=swNetInfo(HnetId)~>selDir        HselPtCoord=swNetInfo(HnetId)~>selPtCoord        HselFigPt=swNetInfo(HnetId)~>selFigPt        HnetLayerName=HnetId~>layerName        HnetGrp=HnetId~>figGroup        VnetId=nth(i-1Vnets)        Vw=VnetId~>width        VselDir=swNetInfo(VnetId)~>selDir        VselPtCoord=swNetInfo(VnetId)~>selPtCoord        VselFigPt=swNetInfo(VnetId)~>selFigPt        VnetLayerName=VnetId~>layerName        VnetGrp=VnetId~>figGroup                 case(HselDir                      ("Right"   Hstretch=list(xCoord(VselPtCoord)-xCoord(HselPtCoord)+Vw/20)      )                      ("Left"            Hstretch=list(xCoord(VselPtCoord)-xCoord(HselPtCoord)-Vw/20)       )      );case               leStretchFig(HnetIdHstretch HselFigPt)               case(VselDir                      ("Down"         Vstretch=list(0yCoord(HselPtCoord)-yCoord(VselPtCoord)-Hw/2)      )                      ("Up"             Vstretch=list(0yCoord(HselPtCoord)-yCoord(VselPtCoord)+Hw/2)     )      );case               leStretchFig(VnetIdVstretch VselFigPt)          viaLoca=list(xCoord(swNetInfo(VnetId)~>selPtCoord)yCoord(swNetInfo(HnetId)~>selPtCoord))        cstGrpId=cstFindConstraintGroupIn(tf"virtuosoDefaultExtractorSetup" )        viaOptions=viaGetViaOptions(cstGrpId)        viaOptions~>automatic~>minNumCuts=2        viaOptions~>automatic~>cutBBoxOrientation=Orientation        autoViaL=viaGenerateViasAtPoint(cvviaLoca viaOptions               ?topAndBottomLayerslist(HnetLayerName VnetLayerName))        cond(               (HnetGrp mapcar(lambda((x) dbAddFigToFigGroup(HnetGrpx)) autoViaL)   )               (VnetGrp mapcar(lambda((x) dbAddFigToFigGroup(VnetGrpx)) autoViaL)   )      );cond                 /*foreach(autoViaautoViaL ;change vias enclosure, and align vias to nets edge               autoVia~>layer1Enc=mapcar(lambda((x)if(plusp(0.05-x) then 0.05 else x)) autoVia~>layer1Enc)               autoVia~>layer2Enc=mapcar(lambda((x)if(plusp(0.05-x) then 0.05 else x)) autoVia~>layer2Enc)               autoVia~>originOffset=mapcar(lambda((x)cond( (zerop(x) 0.0)                      (plusp(x)case(Orientation("vertical" 0.38-Hw/2 ) ("horizontal"0.38-Vw/2) ) )                      (minusp(x)case(Orientation("vertical" -(0.38-Hw/2)) ("horizontal"-(0.38-Vw/2))))))                      autoVia~>origin0ffset);mapcar               );foreach*/          geSelectFigs(autoViaL)        );for );let );proc   hiSetBindKey("Layout""Shift<Key>(" "swCreateVias(\"horizontal\")") hiSetBindKey("Layout""Shift<Key>)" "swCreateVias(\"vertical\")")   ;SwNetInfo(netId) can return net'sinformation excluding netId~>?? ;partial select a net, only select onepoint of a pathseg or path, put its dbId in swNetInfo(netId) , ;then use swNetInfo(netId)~>?? toretrieve its net informations which not include in netId~>?? procedure(swNetInfo(netId) let((netInfo selFigPt xBeg yBeg xEnd yEndnetDir netRoute selDir selPt selPtCoord nextPtCoord xFir yFir xSec ySec xLast yLastxSeLa ySeLa netPts)        netInfo=makeTable('net)        selFigPt=geGetSelSetFigPoint(netId)        if(netId~>objType=="pathSeg"   then        xBeg=xCoord(netId~>beginPt)   yBeg=yCoord(netId~>beginPt)        xEnd=xCoord(netId~>endPt)      yEnd=yCoord(netId~>endPt)               if(car(selFigPt)&&!car(last(selFigPt))           then               selPt="beginPt"               selPtCoord=netId~>beginPt               nextPtCoord=netId~>endPt                      when(xBeg==xEnd&&yBeg!=yEnd                      netDir="Vertical"                             if(yBeg>yEnd                             then netRoute="UpToDown"       selDir="Up"                                 else netRoute="DownToUp"       selDir="Down"     );if                      );when                      when(xBeg!=xEnd&&yBeg==yEnd                      netDir="Horizontal"                             if(xBeg>xEnd                             then netRoute="RightToLeft"       selDir="Right"                             else netRoute="LeftToRight"       selDir="Left"  );if                      );when               );if               if(!car(selFigPt)&&car(last(selFigPt))           then               selPt="endPt"               selPtCoord=netId~>endPt               nextPtCoord=netId->beginPt                      when(xBeg==xEnd&&yBeg!=yEnd                      netDir="Vertical"                             if(yBeg>yEnd                              then netRoute="UpToDown"       selDir="Down"                             else netRoute="DownToUp"       selDir="Up"    );if                      );when                      when(xBeg!=xEnd&&yBeg==yEnd                      netDir="Horizontal"                             if(xBeg>xEnd                             then netRoute="RightToLeft"       selDir="Left"                             else netRoute="LeftToRight"       selDir="Right"       );if                      );when               );if        );if          if(netId~>objType=="path"  then        netPts=netId~>points        xFir=xCoord(nth(0netPts))          yFir=yCoord(nth(0netPts))        xSec=xCoord(nth(1netPts))        ySec=yCoord(nth(1 netPts))        xLast=xCoord(nth(0reverse(netPts))) yLast=yCoord(nth(0reverse(netPts)))        xSeLa=xCoord(nth(1reverse(netPts))) ySeLa=yCoord(nth(1reverse(netPts)))               if(car(selFigPt)&&!car(last(selFigPt))           then               selPt="firstPt"               selPtCoord=nth(0netPts)               nextPtCoord=nth(1netPts)                      when(xFir==xSec&&yFir!=ySec                      netDir="Vertical"                             if(yFir>ySec                             then       netRoute="UpToDown"       selDir="Up"                             else        netRoute="DownToUp"       selDir="Down"      );if                      );when                      when(xFir!=xSec&&yFir==ySec                      netDir="Horizontal"                      if(xFir>xSec                      then       netRoute="RightToleft"        selDir="Right"                      else        netRoute="LeftToRight"       selDir="Left"  );if                      );when               );if               if(!car(selFigPt)&&car(last(selFigPt))           then               selPt="lastPt"               selPtCoord=nth(0reverse(netPts))               nextPtCoord=nth(1reverse(netPts))                      when(xLast==xSeLa&&yLast!=ySeLa                      netDir="Vertical"                             if(yLast<ySeLa                             then       netRoute="UpToDown"              selDir="Down"                             else        netRoute="DownToUp"              selDir="Up"           );if                      );when                      when(xLast!=xSeLa&&yLast==ySeLa                      netDir="Horizontal"                             if(xLast<xSeLa                             then       netRoute="RightToLeft"              selDir="Left"                             else        netRoute="LeftToRight"              selDir="Right"              );if                      );when               );if        );if        netInfo['net]=netId        netInfo['selFigPt]=selFigPt        netInfo['netDir]=netDir        netInfo['netRoute]=netRoute        netInfo['selDir]=selDir        netInfo['selPt]=selPt        netInfo['selPtCoord]=selPtCoord        netInfo['nextPtCoord]=nextPtCoord          netInfo );let );proc  
 
 |