在好例子网,分享、交流、成长!
您当前所在位置:首页Others 开发实例一般编程问题 → Cadence allegro 自动摆放PCB丝印(Silk_replay.il)

Cadence allegro 自动摆放PCB丝印(Silk_replay.il)

一般编程问题

下载此实例
  • 开发语言:Others
  • 实例大小:0.03M
  • 下载次数:6
  • 浏览次数:244
  • 发布时间:2020-12-19
  • 实例类别:一般编程问题
  • 发 布 人:longheshang
  • 文件格式:.il
  • 所需积分:2
 相关标签: ALLEGRO CADENCE pcb cad NC

实例介绍

可以把PCB上的丝印自动摆放在器件中间。非常好用

from clipboard


axlCmdRegister("SR" 'silkreplay)

procedure(silkreplay()   ;load("c:\\skill_project\\silk_replay1.il") axlFormTest("Silk_Form.form")
      Export_Layer=0
    Import_Layer=0
Silkreplay_Form = axlFormCreate('sr "c:\\skill_project\\Silk_Form.form" nil 'silkreplay_callback t)
; printf("the form is %L\n" Silkreplay_Form)   
  axlFormDisplay(Silkreplay_Form)

);procedure


procedure(silkreplay_callback( Silkreplay_Form)
   prog(()
  
case( Silkreplay_Form->curField
("Done"
 
        axlUIWUpdate(nil)
         axlFormClose(Silkreplay_Form)
         axlCancelEnterFun()
         nil
)
("Cancel"
       
         axlFormClose(Silkreplay_Form)
         axlCancelEnterFun()
         nil
        )

("Help_SR"
Help_file()
)

("Export_Top"
  if( Silkreplay_Form->curValue
  then 
   output=outfile("./SilkPiont_TOP.lst")
   Export_Layer=1
;printf("Export_Layer:  %L\n" Export_Layer)    
   );if
       
)
("Export_Bot"
    if( Silkreplay_Form->curValue
  then
  output=outfile("./SilkPiont_BOT.lst")
  Export_Layer=2
;printf("Export_Layer:  %L\n" Export_Layer)      
 
  );if
)
("Export_All"
if( Silkreplay_Form->curValue
then
  output=outfile("./SilkPiont_All.lst")
  Export_Layer=3 
;printf("Export_Layer:  %L\n" Export_Layer)   
  );if
      
)
      ("export"
       
; printf("Export_Layer%d:  %d\n" i Export_Layer) 

         All_Sym_Text_List=nil
         Text_Delete_list=nil
         design_dbid=axlDBGetDesign()
         
         allcomps=design_dbid->components
      foreach(comps allcomps
          sym = comps -> symbol
          when( sym != nil
              Silk_Count=0
              foreach(rt_temp axlDBGetAttachedText(sym)
                  
                  if(rt_temp-> layer=="REF DES/SILKSCREEN_TOP" || rt_temp-> layer=="REF DES/SILKSCREEN_BOTTOM"
                  then
                     Silk_Count=1
                  );if
                );foreach
                if(Silk_Count==0
                then
                   Text_Delete_list=cons(comps->name Text_Delete_list)
                   Silk_Count=2
                 );if 
              foreach(rt axlDBGetAttachedText(sym)
                
                           
                when(or(
                        rt -> layer == "REF DES/SILKSCREEN_TOP" 
                        rt -> layer == "REF DES/SILKSCREEN_BOTTOM"
                        );or 
                     Sym_Name= comps -> name                                     
                     when( and(rt -> text == Sym_Name)
                         text_bbox = rt -> bBox 
                         comps_bbox = comps -> symbol -> xy
    
                         lx = xCoord(lowerLeft(text_bbox))
                         ly = yCoord(lowerLeft(text_bbox))
                         rx = xCoord(upperRight(text_bbox))
                         ry = yCoord(upperRight(text_bbox))
                         text_center_x = (rx lx) / 2 
                         text_center_y = (ry ly) / 2
                         Text_Rotation=rt-> rotation
                         if(rt -> layer== "REF DES/SILKSCREEN_TOP" && Export_Layer==1
                         then
 
                         Top_Sym_Text_List=list("Top" Sym_Name list(text_center_x text_center_y) 
                                                           Text_Rotation xCoord(comps_bbox)  yCoord(comps_bbox) )
                         
                         All_Sym_Text_List=cons(Top_Sym_Text_List All_Sym_Text_List)
                        fprintf(output "Top   %-10s   %-20f   %-20f   %-10f   %-20f   %-20f\n"  Sym_Name text_center_x  
                                                      text_center_y Text_Rotation xCoord(comps_bbox)  yCoord(comps_bbox))                      
             
                            );if  
                         if(rt -> layer== "REF DES/SILKSCREEN_BOTTOM" && Export_Layer==2
                         then
      
                         Bottom_Sym_Text_List=list("Bottom" Sym_Name list(text_center_x text_center_y) 
                                                   Text_Rotation xCoord(comps_bbox)  yCoord(comps_bbox))
                       fprintf(output "Bot   %-10s   %-20f   %-20f   %-10f   %-20f   %-20f\n"  Sym_Name text_center_x  
                                                             text_center_y Text_Rotation xCoord(comps_bbox)  yCoord(comps_bbox))   
                          All_Sym_Text_List=cons(Bottom_Sym_Text_List All_Sym_Text_List)
           
                         );if
                        
                         if(Export_Layer==3
                         then
                           if(rt -> layer== "REF DES/SILKSCREEN_TOP" 
                            then 
                            Top_Sym_Text_List=list("Top" Sym_Name list(text_center_x text_center_y) 
                                                   Text_Rotation xCoord(comps_bbox)  yCoord(comps_bbox))
                            
                            All_Sym_Text_List=cons(Top_Sym_Text_List All_Sym_Text_List)
                           fprintf(output "Top   %-10s   %-20f   %-20f   %-10f   %-20f   %-20f\n"  Sym_Name text_center_x  
                                                          text_center_y Text_Rotation xCoord(comps_bbox)  yCoord(comps_bbox))                      
                
                               );if  
                            if(rt -> layer== "REF DES/SILKSCREEN_BOTTOM" 
                            then
      
                            Bottom_Sym_Text_List=list("Bottom" Sym_Name list(text_center_x text_center_y) 
                                                      Text_Rotation xCoord(comps_bbox)  yCoord(comps_bbox))
                          fprintf(output "Bot   %-10s   %-20f   %-20f   %-10f   %-20f   %-20f\n"  Sym_Name text_center_x  
                                                        text_center_y Text_Rotation xCoord(comps_bbox)  yCoord(comps_bbox))   
                             All_Sym_Text_List=cons(Bottom_Sym_Text_List All_Sym_Text_List)
           
                            );if
             
                         );if
                        );when 
                       );when
                     );foreach          
                 );when                    
             );foreach
        if(Text_Delete_list
        then
        output_text=outfile("./Text_Delete.log")
        Text_Delete_list=cons("These symbols' TEXT have been deleted. Pleace check them." Text_Delete_list)
        foreach(Text_del_Temp Text_Delete_list
          fprintf(output_text "%s\n \n" Text_del_Temp)
          );foreach
          close(output_text)
          axlUIViewFileCreate("Text_Delete.log" "Text Delete Log" t)  
        );if

        close(output)
      )
      
      ("Import_Top"
       if( Silkreplay_Form->curValue
  then
  input=infile("SilkPiont_TOP.lst")
  Import_Layer=1
  );if
)
("Import_Bot"
  if( Silkreplay_Form->curValue
  then
  input=infile("SilkPiont_BOT.lst")
  Import_Layer=2
  );if
)
("Import_All"
  if( Silkreplay_Form->curValue
  then
  input=infile("SilkPiont_All.lst")
  Import_Layer=3
  );if
)
      
      ("import"
         Top_Sym_Text_list=nil 
         Bot_Sym_Text_list=nil 
         Sym_Text_list=nil
         Text_Del_list=nil
         design_dbid=axlDBGetDesign()         
         allcomps=design_dbid->components
         foreach(comps allcomps
          sym = comps -> symbol
          
          when( sym != nil
              Silk_Count=0
              foreach(rt_temp axlDBGetAttachedText(sym)
                  
                  if(rt_temp-> layer=="REF DES/SILKSCREEN_TOP" || rt_temp-> layer=="REF DES/SILKSCREEN_BOTTOM"
                  then
                     Silk_Count=1
                  );if
                );foreach
                if(Silk_Count==0
                then
                   Text_Del_list=cons(comps->name Text_Del_list)
                   Silk_Count=2
                 );if 
          
              foreach(rt axlDBGetAttachedText(sym)
                
                     
                when(or(
                        rt -> layer == "REF DES/SILKSCREEN_TOP" 
                        rt -> layer == "REF DES/SILKSCREEN_BOTTOM"
                        
                       );or 
                     Sym_Name= comps -> name                                     
                     when( and(rt -> text == Sym_Name)
                      comps_bbox1 =sym -> xy
                      if(rt -> layer=="REF DES/SILKSCREEN_TOP" 
                      then
                      text_bbox1 = rt -> bBox 
                      
                      Text_Rotation_New=rt->rotation
                      lx1 = xCoord(lowerLeft(text_bbox1))
                      ly1 = yCoord(lowerLeft(text_bbox1))
                      rx1 = xCoord(upperRight(text_bbox1))
                      ry1 = yCoord(upperRight(text_bbox1))
                      text_center_x1 = (rx1 lx1) / 2 
                       text_center_y1 = (ry1 ly1) / 2 
                      Sym_Text_List_Temp=list("Top" rt ->text rt list(text_center_x1 text_center_y1) 
                                               Text_Rotation_New comps_bbox1 sym)
                      Top_Sym_Text_list=cons(Sym_Text_List_Temp Top_Sym_Text_list)
                      Sym_Text_list=cons(Sym_Text_List_Temp Sym_Text_list)
                      
                      
                      );if
                      if(rt -> layer=="REF DES/SILKSCREEN_BOTTOM" 
                      then
                      text_bbox2 = rt -> bBox 
                      Text_Rotation_New2=rt->rotation
                      lx2 = xCoord(lowerLeft(text_bbox2))
                      ly2 = yCoord(lowerLeft(text_bbox2))
                      rx2 = xCoord(upperRight(text_bbox2))
                      ry2 = yCoord(upperRight(text_bbox2))
                      text_center_x2 = (rx2 lx2) / 2 
                       text_center_y2 = (ry2 ly2) / 2 
                      Sym_Text_List_Temp=list("Bot" rt -> text rt list(text_center_x2 text_center_y2) 
                                               Text_Rotation_New2 comps_bbox1 sym)
                      Bot_Sym_Text_list=cons(Sym_Text_List_Temp Bot_Sym_Text_list)
                      Sym_Text_list=cons(Sym_Text_List_Temp Sym_Text_list)
                      );if
                      
                     );when
                  );when
                );foreach
             );when 
                           
           );foreach
           
           if(Text_Del_list
           then
           output_text=outfile("./Text_Del.log")
           Text_Del_list=cons("These symbols' TEXT have been deleted. Pleace check them." Text_Del_list)
           foreach(Text_del_Temp Text_Del_list
             fprintf(output_text "%s\n \n" Text_del_Temp)
             );foreach
             close(output_text)
             axlUIViewFileCreate("Text_Del.log" "Text Delete Log" t)  
           );if       
 
          
         if(input && Import_Layer==1
         then
         output_top=outfile("./Silk_Replay_Top.log")
         output_move_top=outfile("./Silk_Mismatch_Top.log")
         Top_Text_Match=0
         Top_Text_Mismatch_List=nil
         Move_Sym_List=nil
           while( gets(Temp_Text input) 

            if(Temp_Text
            then

             Temp_Text_Layer=substring(Temp_Text 1 3)
             Temp_Text_Name=substring(Temp_Text 7 10)
             text_center_x=atoi(substring(Temp_Text 20 20))
             text_center_y=atoi(substring(Temp_Text 43 20))
             Text_Rotation_Old=atoi(substring(Temp_Text 66 3))
             Sym_x=atoi(substring(Temp_Text 79 20))
             Sym_y=atoi(substring(Temp_Text 102 20))
;fprintf(output_top "Sym_x:%d\n Sym_y:%d\n " Sym_x Sym_y)            
;fprintf(output "Text_Rotation_Old: %d  \n" Text_Rotation_Old )             
             foreach(Sym_Text Top_Sym_Text_list
                Sym_Layer=nth(0 Sym_Text)
                Sym_Name=nth(1 Sym_Text)
                Sym_Text_Dbid=nth(2 Sym_Text)
                Sym_Text_Point=nth(3 Sym_Text)
                Sym_Text_Rotation=nth(4 Sym_Text)
                Sym_Point=nth(5 Sym_Text)
                Comp_Dbid=nth(6 Sym_Text)
                Sym_Point_x=nth(0 Sym_Point)
                Sym_Point_y=nth(1 Sym_Point)
                Text_Length=nindex(Temp_Text_Name " ")
                Temp_Text_Name_New=substring(Temp_Text_Name 1 Text_Length-1)
           
                if(Sym_Layer==Temp_Text_Layer && Temp_Text_Name_New==Sym_Name
                   then
                
                   Sym_Text_Point_x=nth(0 Sym_Text_Point)
                   Sym_Text_Point_y=nth(1 Sym_Text_Point)
                   axlTransformObject(Sym_Text_Dbid , ?angle (Text_Rotation_Old-Sym_Text_Rotation))
                   axlTransformObject(Sym_Text_Dbid , ?move list(text_center_x-Sym_Text_Point_x ,text_center_y-Sym_Text_Point_y))
                   if(abs(Sym_Point_x-Sym_x)>2.0 || abs(Sym_Point_y-Sym_y)>2.0
                   then
                   
                   Move_Sym_List=cons(Comp_Dbid Move_Sym_List)
                   );if
                   
                   Top_Text_Match=1
                   );if
         
              );foreach
            if(Top_Text_Match==0
            then
            Top_Text_Mismatch_List=cons(Temp_Text_Name Top_Text_Mismatch_List)
            
            );if
           Top_Text_Match=0  
             else
              axlUIConfirm("There is no Top RefDevs Text.")
         
             );if
          
           );while  
             
            close(input) 
          if(Top_Text_Mismatch_List
          then
         
          Top_Text_Mismatch_List=cons("These symbols are in wrong Layer:" Top_Text_Mismatch_List)
          foreach(Top_Text_Mismatch_List_Temp Top_Text_Mismatch_List
          
              fprintf(output_top "%s\n \n" Top_Text_Mismatch_List_Temp)
              
          );foreach
          
          close(output_top)
          axlUIViewFileCreate("Silk_Replay_Top.log" "Silk Replay Log" t)

          );if  
          axlClearSelSet()        
          axlSetFindFilter( ?enabled  '("noall" "COMPONENTS" "SYMBOLS" ) ?onButtons '("SYMBOLS" ) )
          axlHighlightObject(Move_Sym_List nil)
          if(Move_Sym_List
          then
          fprintf(output_move_top "These symbols have been moved:\n")
          foreach(Move_Sym_List_temp Move_Sym_List
          
              fprintf(output_move_top "%s\n \n" Move_Sym_List_temp->refdes)
              
          );foreach
          
          close(output_move_top)
          axlUIViewFileCreate("Silk_Mismatch_Top.log" "Silk Mismatch Log" t)
          
          );if
;printf("hight:%L\n" Move_Sym_List)          
        
         axlClearSelSet()  
         
         );if

           
         if(input && Import_Layer==2
         then
         output_bot=outfile("./Silk_Replay_Bot.log")
         output_move_top=outfile("./Silk_Mismatch_Top.log")
         Bot_Text_Match=0
         Bot_Text_Mismatch_List=nil
         Move_Sym_List=nil
           while( gets(Temp_Text input) 

            if(Temp_Text
            then
        
             Temp_Text_Layer=substring(Temp_Text 1 3)
             Temp_Text_Name=substring(Temp_Text 7 10)
             text_center_x=atoi(substring(Temp_Text 20 20))
             text_center_y=atoi(substring(Temp_Text 43 20))
             Text_Rotation_Old=atoi(substring(Temp_Text 66 3))
             Sym_x=atoi(substring(Temp_Text 79 20))
             Sym_y=atoi(substring(Temp_Text 102 20))
             
;fprintf(output "Text_Rotation_Old: %d  \n" Text_Rotation_Old )             
             foreach(Sym_Text Bot_Sym_Text_list
                Sym_Layer=nth(0 Sym_Text)
                Sym_Name=nth(1 Sym_Text)
                Sym_Text_Dbid=nth(2 Sym_Text)
                Sym_Text_Point=nth(3 Sym_Text)
                Sym_Text_Rotation=nth(4 Sym_Text)
                Sym_Point=nth(5 Sym_Text)
                Comp_Dbid=nth(6 Sym_Text)
                Sym_Point_x=nth(0 Sym_Point)
                Sym_Point_y=nth(1 Sym_Point)
                Text_Length=nindex(Temp_Text_Name " ")
                Temp_Text_Name_New=substring(Temp_Text_Name 1 Text_Length-1)
               
                if(Sym_Layer==Temp_Text_Layer && Temp_Text_Name_New==Sym_Name
                   then
                
                   Sym_Text_Point_x=nth(0 Sym_Text_Point)
                   Sym_Text_Point_y=nth(1 Sym_Text_Point)
                   axlTransformObject(Sym_Text_Dbid , ?angle (Text_Rotation_Old-Sym_Text_Rotation))
                   axlTransformObject(Sym_Text_Dbid , ?move list(text_center_x-Sym_Text_Point_x ,text_center_y-Sym_Text_Point_y))
                   if(abs(Sym_Point_x-Sym_x)>2.0 || abs(Sym_Point_y-Sym_y)>2.0
                   then
                   
                   Move_Sym_List=cons(Comp_Dbid Move_Sym_List)
                   );if
                   Bot_Text_Match=1
                   );if
         
              );foreach 
            if(Bot_Text_Match==0
            then
            Bot_Text_Mismatch_List=cons(Temp_Text_Name Bot_Text_Mismatch_List)
            
            );if
          Bot_Text_Match=0  
              else
             axlUIConfirm("There is no Bottom RefDevs Text.")       
             );if  
             
           
            );while  
             
            close(input) 
          if(Bot_Text_Mismatch_List
          then
         
             Bot_Text_Mismatch_List=cons("These symbols are in wrong Layer:" Bot_Text_Mismatch_List)
             foreach(Bot_Text_Mismatch_List_Temp Bot_Text_Mismatch_List
                 fprintf(output_bot "%s\n \n" Bot_Text_Mismatch_List_Temp)
             );foreach
              close(output_bot)
              axlUIViewFileCreate("Silk_Replay_Bot.log" "Silk Replay Log" t)
              );if
            axlClearSelSet()        
          axlSetFindFilter( ?enabled  '("noall" "COMPONENTS" "SYMBOLS" ) ?onButtons '("SYMBOLS" ) )
          axlHighlightObject(Move_Sym_List nil)
          if(Move_Sym_List
          then
          fprintf(output_move_top "These symbols have been moved:\n")
          foreach(Move_Sym_List_temp Move_Sym_List
          
              fprintf(output_move_top "%L\n \n" Move_Sym_List_temp->refdes)
              
          );foreach
          
          close(output_move_top)
          axlUIViewFileCreate("Silk_Mismatch_Top.log" "Silk Mismatch Log" t)
          
          );if
;printf("hight:%L\n" Move_Sym_List)          
        
         axlClearSelSet()    
              
         );if
      
       
          
         if(input && Import_Layer==3
         then
         output_all=outfile("./Silk_Replay_All.log")
         output_move_top=outfile("./Silk_Mismatch_Top.log")
         All_Text_Match=0
         All_Text_Mismatch_List=nil
         Move_Sym_List=nil
;         All_Sym_Mismatch_List=nil
           while( gets(Temp_Text input) 

            if(Temp_Text
            then
        
             Temp_Text_Layer=substring(Temp_Text 1 3)
             Temp_Text_Name=substring(Temp_Text 7 10)
             text_center_x=atoi(substring(Temp_Text 20 20))
             text_center_y=atoi(substring(Temp_Text 43 20))
             Text_Rotation_Old=atoi(substring(Temp_Text 66 3))
             Sym_x=atoi(substring(Temp_Text 79 20))
             Sym_y=atoi(substring(Temp_Text 102 20))
;fprintf(output "Text_Rotation_Old: %d  \n" Text_Rotation_Old )             
             foreach(Sym_Text Sym_Text_list
                Sym_Layer=nth(0 Sym_Text)
                Sym_Name=nth(1 Sym_Text)
                Sym_Text_Dbid=nth(2 Sym_Text)
                Sym_Text_Point=nth(3 Sym_Text)
                Sym_Text_Rotation=nth(4 Sym_Text)
                Sym_Point=nth(5 Sym_Text)
                Comp_Dbid=nth(6 Sym_Text)
                Sym_Point_x=nth(0 Sym_Point)
                Sym_Point_y=nth(1 Sym_Point)
                Text_Length=nindex(Temp_Text_Name " ")
                Temp_Text_Name_New=substring(Temp_Text_Name 1 Text_Length-1)
          
                if(Sym_Layer==Temp_Text_Layer && Temp_Text_Name_New==Sym_Name
                   then
                
                   Sym_Text_Point_x=nth(0 Sym_Text_Point)
                   Sym_Text_Point_y=nth(1 Sym_Text_Point)
                   axlTransformObject(Sym_Text_Dbid , ?angle (Text_Rotation_Old-Sym_Text_Rotation))
                   axlTransformObject(Sym_Text_Dbid , ?move list(text_center_x-Sym_Text_Point_x ,text_center_y-Sym_Text_Point_y))
                   if(abs(Sym_Point_x-Sym_x)>2.0 || abs(Sym_Point_y-Sym_y)>2.0
                   then
                   
                   Move_Sym_List=cons(Comp_Dbid Move_Sym_List)
                   );if
                   All_Text_Match=1
                   );if
         
              );foreach
            if(All_Text_Match==0
            then
            All_Text_Mismatch_List=cons(Temp_Text_Name All_Text_Mismatch_List)
;            All_Sym_Mismatch_List=cons(Comp_Dbid All_Sym_Mismatch_List)
            
            );if
          All_Text_Match=0  
           
            else
            axlUIConfirm("There is no RefDevs Text.")
           
             );if
        );while   
             
            close(input) 
          if(All_Text_Mismatch_List
          then
         
          All_Text_Mismatch_List=cons("These symbols are in wrong Layer:" All_Text_Mismatch_List)
          foreach(All_Text_Mismatch_List_Temp All_Text_Mismatch_List
          fprintf(output_all "%s\n \n" All_Text_Mismatch_List_Temp)
          );foreach
          close(output_all)
          axlUIViewFileCreate("Silk_Replay_All.log" "Silk Replay Log" t)   
          );if
         axlClearSelSet()        
          axlSetFindFilter( ?enabled  '("noall" "COMPONENTS" "SYMBOLS" ) ?onButtons '("SYMBOLS" ) )
          axlHighlightObject(Move_Sym_List nil)
          if(Move_Sym_List
          then
          fprintf(output_move_top "These symbols have been moved:\n")
          foreach(Move_Sym_List_temp Move_Sym_List
          
              fprintf(output_move_top "%s\n \n" Move_Sym_List_temp->refdes)
              
          );foreach
          
          close(output_move_top)
          axlUIViewFileCreate("Silk_Mismatch_Top.log" "Silk Mismatch Log" t)
          
          );if
;printf("hight:%L\n" Move_Sym_List)          
        
         axlClearSelSet()   
          
         );if
      )
      
      ("SilkCenter"
        design_dbid=axlDBGetDesign()
        Text_Dele_list=nil
        if(axlUIYesNo("Do you want to remove the silkscreen?")
        then
        allcomps=design_dbid->components
        foreach(comps allcomps
               sym = comps -> symbol
             
            when( sym != nil
                Silk_Count=0
               foreach(rt_temp axlDBGetAttachedText(sym)
;printf("rt_temp:%L\n" rt_temp)                  
                  if(or(
                        rt_temp-> layer=="REF DES/SILKSCREEN_TOP" 
                        rt_temp-> layer=="REF DES/SILKSCREEN_BOTTOM"
                        rt_temp -> layer == "REF DES/ASSEMBLY_TOP"
                        rt_temp -> layer == "REF DES/ASSEMBLY_BOTTOM")
                  then
                     Silk_Count=1
;printf("Silk_Count:%d\n" Silk_Count)                     
                  );if
                );foreach
                
                
                if(Silk_Count==0
                then
                   Text_Dele_list=cons(comps->name Text_Dele_list)
                   Silk_Count=2
                 );if 
                foreach(rt axlDBGetAttachedText(sym)
                    when(or(
                        rt -> layer == "REF DES/SILKSCREEN_TOP" 
                        rt -> layer == "REF DES/SILKSCREEN_BOTTOM"
                        rt -> layer == "REF DES/ASSEMBLY_TOP"
                        rt -> layer == "REF DES/ASSEMBLY_BOTTOM"
                        )                                     
                        when( and(rt -> text == comps -> name)
                            comps_bbox =axlDBAltOrigin('center comps -> symbol)
                            comps_rat=comps -> symbol -> rotation
                            comps_center_x = xCoord(comps_bbox)
                            comps_center_y = yCoord(comps_bbox)
                    
                            text_bbox =axlDBAltOrigin('center rt)

                            text_center_x =xCoord(text_bbox) 
                            text_center_y =yCoord(text_bbox)
/*                            if(comps_rat!=rt->rotation
                            then
                            rat_text=comps_rat-rt->rotation
                            axlTransformObject(rt , ?angle rat_text  ?origin text_center_x:text_center_y)
                            );if
*/
                            axlTransformObject(rt , ?move list(comps_center_x - text_center_x ,comps_center_y - text_center_y))
                            

                                             
                            if((comps_rat==90 || comps_rat==270) && rt->rotation!=270   
                            then   
                                rat_a=270-rt->rotation              
                                axlTransformObject(rt ,  ?angle rat_a  ?origin comps_center_x:comps_center_y  )
                              )
                     
                            if((comps_rat==0 || comps_rat==180) && rt->rotation!=0   
                            then   
                                rat_b=360-rt->rotation              
                                axlTransformObject(rt ,  ?angle rat_b  ?origin comps_center_x:comps_center_y  )
                              );if
                              
                         );when        
                    );when                    
                );foreach
            );when
        );foreach
        
        if(Text_Dele_list
           then
           output_text=outfile("./Text_Dele.log")
           Text_Dele_list=cons("These symbols' TEXT have been deleted. Pleace check them." Text_Dele_list)
           foreach(Text_del_Temp Text_Dele_list
             fprintf(output_text "%s\n \n" Text_del_Temp)
             );foreach
             close(output_text)
             axlUIViewFileCreate("Text_Dele.log" "Text Delete Log" t)  
           );if  
           
        );if
      )
      
      ("SilkCenter_rotation"
        design_dbid=axlDBGetDesign()
        Text_Dele_list=nil
        if(axlUIYesNo("Do you want to remove the silkscreen?")
        then
        allcomps=design_dbid->components
        foreach(comps allcomps
               sym = comps -> symbol
             
            when( sym != nil
                Silk_Count=0
               foreach(rt_temp axlDBGetAttachedText(sym)
;printf("rt_temp:%L\n" rt_temp)                  
                  if(or(
                        rt_temp-> layer=="REF DES/SILKSCREEN_TOP" 
                        rt_temp-> layer=="REF DES/SILKSCREEN_BOTTOM"
                        rt_temp -> layer == "REF DES/ASSEMBLY_TOP"
                        rt_temp -> layer == "REF DES/ASSEMBLY_BOTTOM")
                  then
                     Silk_Count=1
;printf("Silk_Count:%d\n" Silk_Count)                     
                  );if
                );foreach
                
                
                if(Silk_Count==0
                then
                   Text_Dele_list=cons(comps->name Text_Dele_list)
                   Silk_Count=2
                 );if 
                foreach(rt axlDBGetAttachedText(sym)
                    when(or(
                        rt -> layer == "REF DES/SILKSCREEN_TOP" 
                        rt -> layer == "REF DES/SILKSCREEN_BOTTOM"
                        rt -> layer == "REF DES/ASSEMBLY_TOP"
                        rt -> layer == "REF DES/ASSEMBLY_BOTTOM"
                        
                        )                                     
                        when( and(rt -> text == comps -> name)
                            comps_bbox =axlDBAltOrigin('center comps -> symbol)
                            comps_rat=comps -> symbol -> rotation
                            comps_center_x = xCoord(comps_bbox)
                            comps_center_y = yCoord(comps_bbox)
                    
                            text_bbox =axlDBAltOrigin('center rt)
                            text_center_x =xCoord(text_bbox) 
                            text_center_y =yCoord(text_bbox) 

                            
                           
                            axlTransformObject(rt , ?move list(comps_center_x - text_center_x ,comps_center_y - text_center_y))
                            

                                             
                            if((comps_rat==90 || comps_rat==270) && rt->rotation!=270   
                            then   
                                rat_a=270-rt->rotation              
                                axlTransformObject(rt ,  ?angle rat_a  ?origin comps_center_x:comps_center_y  )
                              )
                     
                            if((comps_rat==0 || comps_rat==180) && rt->rotation!=0   
                            then   
                                rat_b=360-rt->rotation              
                                axlTransformObject(rt ,  ?angle rat_b  ?origin comps_center_x:comps_center_y  )
                              );if
                            rat_text=90
                            axlTransformObject(rt , ?angle rat_text  ?origin comps_center_x:comps_center_y)  
                         );when        
                    );when                    
                );foreach
            );when
        );foreach
        
        if(Text_Dele_list
           then
           output_text=outfile("./Text_Dele.log")
           Text_Dele_list=cons("These symbols' TEXT have been deleted. Pleace check them." Text_Dele_list)
           foreach(Text_del_Temp Text_Dele_list
             fprintf(output_text "%s\n \n" Text_del_Temp)
             );foreach
             close(output_text)
             axlUIViewFileCreate("Text_Dele.log" "Text Delete Log" t)  
           );if  
           
        );if
      )
      
    );case 
     
  );prog    
 );procedure
 
 
 procedure(Help_file()
          
   info = outfile("./Silk_Replay.info" "w") 
   fprintf(info "  ########################################################################\n")
   fprintf(info "  #                                                                      #\n")
   fprintf(info "  #                          Silk Replay Funtion                         #\n")
   fprintf(info "  #                                                                      #\n")
   fprintf(info "  ########################################################################\n")
   fprintf(info "     \n")   
   fprintf(info "    Revision: Apr. 20, 2012    \n")
   fprintf(info "    By: Bill Chen - Powerleader Technology Research \n")
   fprintf(info "    Email: hanlong.chen@Powerleader.com.cn \n")    
   fprintf(info "    Telephone: 0755-29528988-8553 \n")
   fprintf(info "     \n")
   fprintf(info "     \n")
   fprintf(info "-----------------------------------------------------------------------------\n")
   fprintf(info "|                                                                           |\n")
   fprintf(info "|      This Silk Replay function contain 3 models. It can check whether the |\n")
   fprintf(info "|      symbol's Text has been delete for careless.                          |\n")
   fprintf(info "|      The detail usage shows as follows.                                   |\n")
   fprintf(info "|                                                                           |\n")
   fprintf(info "|                                                                           |\n")
   fprintf(info "|       #############################################################       |\n")
   fprintf(info "|       #                                                           #       |\n")
   fprintf(info "|       #                Locate RefDes to the symbol                #       |\n")
   fprintf(info "|       #                                                           #       |\n")
   fprintf(info "|       #############################################################       |\n")
   fprintf(info "|                                                                           |\n")
   fprintf(info "|          This model can move the device's reference to the middle of      |\n")
   fprintf(info "|      the symbol point in the same direction.                              |\n")
   fprintf(info "|          You can run this model befor you first arrange the RefDes.       |\n")
   fprintf(info "|      And you can also run this model when the factory needs for Assembly. |\n")
   fprintf(info "|          Note: When it run as Assembly, the RefDes may overlap the        |\n")
   fprintf(info "|      silkscreen on the package, kinds of 0402 resistors, for example.     |\n")
   fprintf(info "|                                                                           |\n")
   fprintf(info "|       #############################################################       |\n")
   fprintf(info "|       #                                                           #       |\n")
   fprintf(info "|       #                Export the RefDes                          #       |\n")
   fprintf(info "|       #                Import the RefDes                          #       |\n")
   fprintf(info "|       #                                                           #       |\n")
   fprintf(info "|       #############################################################       |\n")
   fprintf(info "|                                                                           |\n")
   fprintf(info "|          These two models are used for design cooperation. Some one       |\n")
   fprintf(info "|      else can help to arrange the RefDes at the last phase of the design. |\n")
   fprintf(info "|      Then the arraged RefDes can be exported form the boardfile           |\n")
   fprintf(info "|      and imported into the design.                                        |\n")
   fprintf(info "|          when you import the RefDes, symbols which have been moved        |\n")
   fprintf(info "|      greater than 3 mils in the design during arranging RefDes,           |\n")
   fprintf(info "|      will be highlight.                                                   |\n")
   fprintf(info "|          And it also will make a symbol list report when symbols had been |\n")
   fprintf(info "|      mirrored in the design during arranging RefDes.                      |\n")
   fprintf(info "|                                                                           |\n")
   fprintf(info "-----------------------------------------------------------------------------\n")
   fprintf(info "\n")
   fprintf(info "\n")
   fprintf(info "\n")
   close(info)
   axlUIViewFileCreate("Silk_Replay.info" "Silk Replay Information" t)
 
 )
 

标签: ALLEGRO CADENCE pcb cad NC

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警