⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clinecut.il

📁 Allegro常用skill
💻 IL
📖 第 1 页 / 共 5 页
字号:
         ;; segment ends do not always go from left-to-right but may go right-to-left.
         if(nthelem(1 nthelem(1 cseg->startEnd)) > nthelem(1 nthelem(2 cseg->startEnd)) then
          cline1 = list(nthelem(2 cseg->startEnd) list(vrx - cutwidth nthelem(2 nthelem(2 cseg->startEnd))))
          cline2 = list(list(vrx nthelem(2 nthelem(2 cseg->startEnd))) nthelem(1 cseg->startEnd))
          p1x = nthelem(1 nthelem(1 cline1))
         else
          cline1 = list(nthelem(1 cseg->startEnd) list(vrx - cutwidth nthelem(2 nthelem(1 cseg->startEnd))))
          cline2 = list(list(vrx nthelem(2 nthelem(1 cseg->startEnd))) nthelem(2 cseg->startEnd))
         ); endif
         etchlayer = cseg->layer
         segnetname = cseg->net->name
         segwidth = cseg->width
         axlDeleteObject(cseg)

         p2x = nthelem(1 nthelem(2 cline1))
         if( p2x > p1x then
          axlDBCreateLine(cline1 segwidth etchlayer segnetname)
         ); endif
         axlDBCreateLine(cline2 segwidth etchlayer segnetname)

       ); cond 3 - end of crossing right vertical boundary line
      ); end cond
     ); end foreach
    ); end "h"

   ("v"
     foreach(cseg listcsegs

      ;; create variables for cseg end points.
      ;; the cseg may start left to right, right to left,
      ;; top to bottom, or bottom to top.

      cXbeg = nthelem(1 nthelem(1 cseg->startEnd))
      cYbeg = nthelem(2 nthelem(1 cseg->startEnd))
      cXend = nthelem(1 nthelem(2 cseg->startEnd))
      cYend = nthelem(2 nthelem(2 cseg->startEnd))
      p1x = cXbeg
      p1y = cYbeg
      p4x = cXend
      p4y = cYend
   /*
      p2x = p1x
      p2y = hty
      p3x = p1x
      p3y = hty - cutwidth
      p5x = p1x
      p5y = hby + cutwidth
      p6x = h1x
      p6y = hby + cutwidth
*/
      cond( ;; Crosses both horizontal lines
       ( (hby > p1y && hby < p4y || hby > p4y && hby < p1y) &&
         (hty > p1y && hty < p4y || hty > p4y && hty < p1y)

        if(debug then
         axlUIWPrint(nil " - Crosses Both H lines")
        ); endif
        if(nthelem(2 nthelem(1 cseg->startEnd)) > nthelem(2 nthelem(2 cseg->startEnd)) then

         cline1 = list(nthelem(1 cseg->startEnd) list(nthelem(1 nthelem(1 cseg->startEnd)) hty))
         cline2 = list(list(nthelem(1 nthelem(1 cseg->startEnd)) hty - cutwidth) list(nthelem(1 nthelem(1 cseg->startEnd)) hby + cutwidth))
         cline3 = list(list(nthelem(1 nthelem(1 cseg->startEnd)) hby) nthelem(2 cseg->startEnd))
         
         p3y = nthelem(2 nthelem(1 cline2))
         p5y = nthelem(2 nthelem(2 cline2))
         if( p3y > p5y then
           cline2seg = t
         else
           cline2seg = nil
         ); endif     
   
        else
        
         cline1 = list(nthelem(1 cseg->startEnd) list(nthelem(1 nthelem(1 cseg->startEnd)) hby))
         cline2 = list(list(nthelem(1 nthelem(1 cseg->startEnd)) hby + cutwidth) list(nthelem(1 nthelem(1 cseg->startEnd)) hty - cutwidth))
         cline3 = list(list(nthelem(1 nthelem(1 cseg->startEnd)) hty) nthelem(2 cseg->startEnd))
         p3y = nthelem(2 nthelem(1 cline2))
         p5y = nthelem(2 nthelem(2 cline2))
         if( p5y > p3y then
           cline2seg = t
         else
           cline2seg = nil
         ); endif
               
        ); endif
        etchlayer = cseg->layer
        segnetname = cseg->net->name
        segwidth = cseg->width
        axlDeleteObject(cseg)

 
        axlDBCreateLine(cline1 segwidth etchlayer segnetname)
        if(cline2seg then
         axlDBCreateLine(cline2 segwidth etchlayer segnetname)
        ); endif
        axlDBCreateLine(cline3 segwidth etchlayer segnetname)
       
        ); cond 1 - end of one segment crossing both horizontal boundary lines

       ( ;; Crosses Bottom Horizontal line
         hby > p1y && hby < p4y || hby > p4y && hby < p1y

         if(debug then
          axlUIWPrint(nil " - Crosses Bottom Hline")
         ); endif
         
         ;; segment ends do not always go from top-to-bottom but may go bottom-to-top.
         if(nthelem(2 nthelem(1 cseg->startEnd)) > nthelem(2 nthelem(2 cseg->startEnd)) then
          cline1 = list(nthelem(1 cseg->startEnd) list(nthelem(1 nthelem(2 cseg->startEnd)) hby + cutwidth))
          cline2 = list(list(nthelem(1 nthelem(2 cseg->startEnd)) hby) nthelem(2 cseg->startEnd))
           p2y = nthelem(2 nthelem(2 cline1))
           p1y = nthelem(2 nthelem(1 cline1))
         else
          cline1 = list(nthelem(1 cseg->startEnd) list(nthelem(1 nthelem(1 cseg->startEnd)) hby))
          cline2 = list(list(nthelem(1 nthelem(1 cseg->startEnd)) hby + cutwidth) nthelem(2 cseg->startEnd))
           p2y = nthelem(2 nthelem(1 cline2))
           p1y = nthelem(2 nthelem(2 cline2))           
         ); endif
         etchlayer = cseg->layer
         segnetname = cseg->net->name
         segwidth = cseg->width
         axlDeleteObject(cseg)

         p3y = nthelem(2 nthelem(1 cline2))
         axlDBCreateLine(cline1 segwidth etchlayer segnetname)
         if(p2y < p1y then
          axlDBCreateLine(cline2 segwidth etchlayer segnetname)
         ); endif
        
       ); cond 2 - end of crossing bottom horizontal  boundary line

       (;; Crosses Top Horizontal line
         hty > p1y && hty < p4y || hty > p4y && hty < p1y

         if(debug then
          axlUIWPrint(nil " - Crosses Top Hline")
         ); endif
         
         ;; segment ends do not always go from left-to-right but may go right-to-left.
         if(nthelem(2 nthelem(1 cseg->startEnd)) > nthelem(2 nthelem(2 cseg->startEnd)) then
          cline1 = list(nthelem(2 cseg->startEnd) list(nthelem(1 nthelem(2 cseg->startEnd)) hty - cutwidth))
          cline2 = list(list(nthelem(1 nthelem(2 cseg->startEnd)) hty) nthelem(1 cseg->startEnd))
          p1y = nthelem(2 nthelem(1 cline1))
          p2y = nthelem(2 nthelem(2 cline2))
         else
          cline1 = list(nthelem(1 cseg->startEnd) list(nthelem(1 nthelem(1 cseg->startEnd)) hty - cutwidth))
          cline2 = list(list(nthelem(1 nthelem(1 cseg->startEnd)) hty) nthelem(2 cseg->startEnd))
          p1y = nthelem(2 nthelem(1 cline1))
          p2y = nthelem(2 nthelem(2 cline2))
         ); endif
         etchlayer = cseg->layer
         segnetname = cseg->net->name
         segwidth = cseg->width
         axlDeleteObject(cseg)
         p2y = nthelem(2 nthelem(2 cline1))
         if( p2y > p1y then
          axlDBCreateLine(cline1 segwidth etchlayer segnetname)
         ); endif
         axlDBCreateLine(cline2 segwidth etchlayer segnetname)
        
       ); cond 3 - end of crossing top horizontal boundary line
      ); end cond
     ); end foreach


   ); end vertical

   ("s"
    ;i = 1
    foreach(cseg listcsegs
      ;; create variables for cseg end points.
      ;; the cseg may start left to right, right to left,
      ;; top to bottom, or bottom to top.

      cXbeg = nthelem(1 nthelem(1 cseg->startEnd))
      cYbeg = nthelem(2 nthelem(1 cseg->startEnd))
      cXend = nthelem(1 nthelem(2 cseg->startEnd))
      cYend = nthelem(2 nthelem(2 cseg->startEnd))

      if(cXend < cXbeg then
       cXbeg = nthelem(1 nthelem(2 cseg->startEnd))
       cYbeg = nthelem(2 nthelem(2 cseg->startEnd))
       cXend = nthelem(1 nthelem(1 cseg->startEnd))
       cYend = nthelem(2 nthelem(1 cseg->startEnd))
      ); endif

      ;; Make some possible intersection calculations.
      cslope = axlLineSlope(cseg->startEnd)

      ;; Y intersection on the vertical boundary lines.
      if(cslope < 0 then
        ylint = cYend + (abs(cslope) *  (cXend - vlx))
        yrint = cYend + (abs(cslope) * (cXend - vrx))
      else
        yrint = cYbeg + (cslope * (vrx - cXbeg))
        ylint = cYbeg + (cslope * (vlx - cXbeg))
      ); endif

     ;; X intersection on the horizontal boundary lines.
      if(cslope < 0 then
        xtint = ((cYbeg - hty) / abs(cslope)) + cXbeg
        xbint = cXend - ( (hby - cYend)/abs(cslope) )       
      else
        xtint = cXend - ( (cYend - hty) / cslope)
        xbint = ((hby - cYbeg) / cslope) + cXbeg
      ); endif

          ;axlUIWPrint(nil " - Cseg %n " i)
      
    cond(

      ( ;; Slope Crosses Left Vertical Boundary Line ONLY.
        (cXbeg < vlx && cXend > vlx) && cYend < hty && cYend > hby &&
        (cXend < vrx) && (ylint > hby && ylint < hty)

        if(debug then
         axlUIWPrint(nil " - Slope crosses left vertical boundary line")
        ); endif
 
       
        p1x = cXbeg
        p1y = cYbeg
        p4x = cXend
        p4y = cYend
        p2x = vlx
        p2y = p1y + (cslope * (vlx - p1x))
        p3x = cutwidth + vlx
        p3y = p2y + (cslope * cutwidth)
        cline1 = list(list(p1x p1y) list(p2x p2y))
        cline2 = list(list(p3x p3y) list(p4x p4y))

        ;; End of left side of boundary line.

        etchlayer = cseg->layer
        segnetname = cseg->net->name
        segwidth = cseg->width
        axlDeleteObject(cseg)

        if(p3x < p4x then
         axlDBCreateLine(cline1 segwidth etchlayer segnetname)
         axlDBCreateLine(cline2 segwidth etchlayer segnetname)
        else
         axlDBCreateLine(cline1 segwidth etchlayer segnetname) 
        ); endif

       ); end left vertical boundary line

    ( ;; Slope Crosses Right Vertical Boundary Line ONLY.
      (cXbeg < vrx && cXend > vrx) && cYbeg < hty && cYbeg > hby &&
      (cXbeg > vlx) &&  (yrint > hby && yrint < hty)

      if(debug then
       axlUIWPrint(nil " - Slope Crosses Right Vline")
      ); endif

      p1x = cXbeg
      p1y = cYbeg
      p4x = cXend
      p4y = cYend
      p2x = vrx - cutwidth
      p2y = p1y + cslope * (p2x - p1x)
      p3x = vrx
      p3y = (cslope * cutwidth) + p2y
      cline1 = list(list(p1x p1y) list(p2x p2y))
      cline2 = list(list(p3x p3y) list(p4x p4y))

      ;; End of right side of boundary line.
      etchlayer = cseg->layer
      segnetname = cseg->net->name
      segwidth = cseg->width
      axlDeleteObject(cseg)

      if(p1x < p2x then
        axlDBCreateLine(cline1 segwidth etchlayer segnetname)
        axlDBCreateLine(cline2 segwidth etchlayer segnetname)
      else
        axlDBCreateLine(cline2 segwidth etchlayer segnetname)
      ); endif


    ); end of right vertical boundary line

   
    ( ;; Slope Crosses  Positive Top Horizontal Boundary Line ONLY.
     (cXbeg > vlx && cXbeg < vrx && cYbeg > hby && cYbeg < hty && cYend > hty) 
        if(debug then
         axlUIWPrint(nil " - Slope Crosses TOP horizontal line")
        ); endif
      
        p1x = cXbeg
        p1y = cYbeg
        p4x = cXend
        p4y = cYend
        p3x = p1x + ((hty - p1y)/cslope)
        p3y = hty
        p2x = p3x - (cutwidth / cslope)
        p2y = hty - cutwidth
        cline1 = list(list(p1x p1y) list(p2x p2y))
        cline2 = list(list(p3x p3y) list(p4x p4y))

        
        etchlayer = cseg->layer
        segnetname = cseg->net->name
        segwidth = cseg->width
        axlDeleteObject(cseg)
     
       if(p1x < p2x then
        axlDBCreateLine(cline1 segwidth etchlayer segnetname)
        axlDBCreateLine(cline2 segwidth etchlayer segnetname)
       else
        axlDBCreateLine(cline2 segwidth etchlayer segnetname)
       ); endif
     
      
    ); end cond of top boundary
   (;; Slope Crosses Negative Top Horizontal Boundary line.
     (cXend > vlx && cXend < vrx && cYend > hby && cYend < hty && cYbeg > hty)
      if(debug then
       axlUIWPrint(nil " - Found NEGative line crossing TOP Horizontal line. -")
      ); endif

        p1x = cXbeg
        p1y = cYbeg
        p4x = cXend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -