EDA365电子论坛网

标题: 【源码】Allegro导出元件高度list [打印本页]

作者: shirdon    时间: 2022-8-24 19:10
标题: 【源码】Allegro导出元件高度list
本帖最后由 shirdon 于 2022-8-25 13:30 编辑

Allegro导出元件高度list。生成excel,09年写的17.4还能用,不错
快捷命令:CHExport

  1. ; =============================================================
  2. ;                      Comp_height_export.il  v.1
  3. ;                        Create by XD
  4. ;                         2009-10-21
  5. ;=============================================================

  6. ;Declare: display all placed component height!



  7. (defun Comp_height_export ()

  8.         symbol_db_list= axlDBGetDesign()->symbols
  9.                
  10.         comp_num= length(axlDBGetDesign()->components)
  11.                
  12.         axlClearSelSet()

  13.         _Comp_Height_Report = outfile("./Comp_height_report.csv" "w")        
  14.         
  15.         fprintf(_Comp_Height_Report ",,Comp_height_report V1.0\n\n")
  16.         
  17.         fprintf(_Comp_Height_Report "======================================================================\n")
  18.         
  19.         fprintf(_Comp_Height_Report "* BoardFile Name:  %s               Allegro Version: %s\n" axlCurrentDesign() axlVersion('fullVersion))
  20.         
  21.         fprintf(_Comp_Height_Report "* Time:  %s\n" getCurrentTime())
  22.         
  23.         fprintf(_Comp_Height_Report "* The Number of Component: %d\n" comp_num)

  24.         fprintf(_Comp_Height_Report "* Remark:  Please make sure that all components have been placed on the main board!\n")

  25.         fprintf(_Comp_Height_Report "======================================================================\n")

  26.         fprintf(_Comp_Height_Report "Refdes,Footprint,Height_Max,Layer\n")

  27.                 setof(symbol_db symbol_db_list
  28.                         
  29.                         refdes = symbol_db->refdes
  30.                
  31.                         if( (refdes!=nil) then
  32.                                 
  33.                                 mir = symbol_db->isMirrored
  34.                         
  35.                                 if(mir then
  36.                         
  37.                                         Fl = "Bottom"
  38.                                 
  39.                                 else
  40.                                 
  41.                                         Fl = "Top"
  42.                                 
  43.                                 )
  44.                                 
  45.                                 shapefound=0
  46.                                 
  47.                                 propfound=0
  48.                                 
  49.                                 twoshapes=0
  50.                                 
  51.                                 shape_bot_found=0
  52.                
  53.                                 children_db_list = symbol_db->children
  54.                         
  55.                                 if( neq(children_db_list nil) then                        ; checks if symbol has attached shapes
  56.                                        
  57.                                         setof(children_db children_db_list
  58.                                        
  59.                                         isShape = children_db->objType
  60.                                        
  61.                                         shape_layer = children_db->layer        
  62.                                        
  63.                                                 if( equal(isShape "shape") then ; checks if shape is on package geometry/place_bound_top
  64.                
  65.                                                         if( equal(shape_layer "PACKAGE GEOMETRY/PLACE_BOUND_TOP") then
  66.                                                                
  67.                                                                 shapefound=1
  68.                                                         
  69.                                                                 if( (shape_bot_found==1) then
  70.                                                                
  71.                                                                         twoshapes=1
  72.                                                         
  73.                                                                 );end if
  74.                                                                
  75.                                                                 proplist= axlDBGetProperties(children_db)
  76.                                                         
  77.                                                                 foreach(prop proplist
  78.                                                                         
  79.                                                                         propS= symbolToString(car(prop))
  80.                                                                         
  81.                                                                         if( (propS=="PACKAGE_HEIGHT_MAX") then
  82.                                                                         
  83.                                                                                 fprintf(_Comp_Height_Report "%s,%s,%s,%s\n" refdes symbol_db->name cadr(prop) Fl)
  84.                                                                         
  85.                                                                                 propfound=1
  86.                                                                         );end if               
  87.                                                                  
  88.                                                                 );end foreach
  89.                                                                
  90.                                                         ) ; end if package geometry
  91.                                                         
  92.                                                         if( equal(shape_layer "PACKAGE GEOMETRY/PLACE_BOUND_BOTTOM") then
  93.                                                         
  94.                                                                 if((shapefound==1) then
  95.                                                                         
  96.                                                                         twoshapes=1
  97.                                                                
  98.                                                                 );end if
  99.                                                         
  100.                                                                 shapefound=1
  101.                                                         
  102.                                                                 shape_bot_found=1
  103.                                                         
  104.                                                                 proplist= axlDBGetProperties(children_db)
  105.                                                         
  106.                                                                 foreach(prop proplist
  107.                                                                
  108.                                                                         propS= symbolToString(car(prop))
  109.                                                                         
  110.                                                                         if( (propS=="PACKAGE_HEIGHT_MAX") then
  111.                                                                                 
  112.                                                                                 fprintf(_Comp_Height_Report "%s,%s,%s,%s\n" refdes symbol_db->name cadr(prop) Fl)
  113.                                                                                 
  114.                                                                                 propfound=1
  115.                                                                         );end if               
  116.                                                                                                                  
  117.                                                                 );end setof
  118.                                                                                                                
  119.                                                         ) ; end of package geometry
  120.                                                         
  121.                                                 ) ; end of is shape        
  122.                                                 
  123.                                         ) ; end of setof
  124.                                 
  125.                                 ) ; end of if children
  126.                         
  127.                         
  128.                                 if( (shapefound==0) then
  129.                                        
  130.                                         printf( "%L has no Place bound shape! \n" refdes)
  131.                                        
  132.                                         Entries=1
  133.                                 );end if
  134.                                 
  135.                                 if( (propfound==0) then
  136.                                        
  137.                                         printf("%L has no Place bound height property! \n" refdes)
  138.                                        
  139.                                         Entries=1
  140.                                 
  141.                                 );end if
  142.                                 
  143.                                 if( (twoshapes==1) then
  144.                                        
  145.                                         printf("%L has two Place_bound shapes! May highlight improperly!! \n" refdes)
  146.                                        
  147.                                         Entries=1
  148.                                 
  149.                                 );end if
  150.                         
  151.                         );end if refdes=nil
  152.                
  153.                 ) ; end of foreach symbol_db
  154.         close(_Comp_Height_Report)

  155. axlHttp("Comp_height_report.csv")   
  156. )

  157. axlCmdRegister( "CHExport" 'Comp_height_export)
复制代码
显示结果:


SH_Comp_height_export.zip

1.28 KB, 下载次数: 3, 下载积分: 贡献 -30 , 威望 -10


作者: Dollche    时间: 2022-8-25 09:28
看一看,学习学习
作者: shirdon    时间: 2022-8-25 13:35
上传附件怎么取消贡献和威望设置,好尴尬




欢迎光临 EDA365电子论坛网 (https://bbs.eda365.com/) Powered by Discuz! X3.2