找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

巢课
电巢直播8月计划
查看: 1550|回复: 9
打印 上一主题 下一主题

pickdata.il 一个反标的程序

[复制链接]

172

主题

733

帖子

-7486

积分

未知游客(0)

积分
-7486
跳转到指定楼层
1#
发表于 2012-4-9 16:24 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

EDA365欢迎您!

您需要 登录 才可以下载或查看,没有帐号?注册

x
;           Creates a file with pick and place data that can be
;                backannotated into Capture/Capture CIS
;           ------------------------------------------
;
;                The program runs from the open allegro board
;
;                To run the program type "pickdata" on the Allegro
;                command line
;
;                The program extracts the following properties into a file  
;                pickdata.swp
;                REF_DES                : Reference Designator
;                SYM_CENTER_X        : Components center x-origin (BODY_CENTER)
;                SYM_CENTER_Y        : Components center y-origin (BODY_CENTER)
;                SYM_ROTATION        : Components rotation
;                SYM_MIRROR                : YES if component is mirror, otherwise NO
;
;                The properties are backannotated into the following properties  
;                in Capture. The properties can be renamed, look in the code.
;                REF_DES                : Does not get back into Capture but is used
;                                        : to find the correct component to update
;                SYM_CENTER_X        : Pick_X
;                SYM_CENTER_Y        : Pick_Y
;                SYM_ROTATION        : Pick_Rotation
;                SYM_MIRROR                : Pick_Mirror
;
;                USAGE :
;                1. Open board in Allegro (make sure the skill program pickdata.il
;                         is loaded
;                2. Write pickdata at the prompt and press ENTER to generate file  
;                3. The file is called pickdata.swp - it is placed in the current  
;                        directory
;                4. In Capture - open the correct project
;                5. Tools - Backannotate
;                6. Select the Layout tab
;                7. Browse and select the pickdata.swp file
;                8. Press OK and look in the session log to see that all is well
;                9. Now open the schematic design and look at properties on parts
;                10. The pick and place data can now be included in reports                 
;
;
; To run the program type "pickdata" on the Allegro  
; command line.
; -----------------------------------------------------------------
; Tested on Allegro 14.1
; The program is delivered as is and no responisibility is taken.
; Use at own risk

; Written by:

; Ole Ejlersen
; Technical Service Manager
; Nordcad Systems A/S - Representing Cadence in Denmark
; I can be reached at the following address:
; E-Mail: oe@nordcad.dk
; -----------------------------------------------------------------  

(defun pickdata ()

extract1_exists = nil
drain(poport)
new_name = axlCurrentDesign()
; Create extract command file
outport = outfile("skill_extract_views.txt")
fprintf( outport , "%s\n\n%s\n%s\n%s\n%s\n%s\n\n%s\n%s\n%s\n%s\n%s\n\n%s\n" ,  
                                        "COMPONENT" ,   
                                        "REFDES != ''" , "SYM_CENTER_X != ''" ,  
                                        "SYM_CENTER_Y != ''" , "SYM_ROTATE != ''" , "SYM_MIRROR != ''" ,
                                        "REFDES" , "SYM_CENTER_X" , "SYM_CENTER_Y" ,
                                        "SYM_ROTATE" , "SYM_MIRROR" , "END")
close( outport)
;extract data from board with extract file
extract1 = strcat("extract -s -q " new_name " skill_extract_views skill_extract_pickdata")
shell( extract1 )

inport = infile("skill_extract_pickdata.txt")
outport = outfile("pickdata.swp")

;Generate header for swap file
fprintf(outport , ";**************************************************\n")
fprintf(outport , ";Backannotation file with pick and place data\n")
fprintf(outport , ";from Cadence Allegro to Capture and Capture CIS\n")
fprintf(outport , ";**************************************************\n")
fprintf( outport , ".Section3 UpdateProperties Parts\n")
;If you want the pick and place data backannotated to other property names than the default
;then you need to change the names in the next line
fprintf( outport , "\"{Reference}\" \"Pick_X\" \"Pick_Y\" \"Pick_Rotation\" \"Pick_Mirror\"\n")
;shell(extract1)
count = 0
count2 = 100
when( inport
        while(gets( nextline inport)
                nextline = parseString(nextline)
                refdes = car(nextline)
                fprintf( outport, "\"")
                fprintf( outport, "%s", refdes)
                fprintf( outport, "\" ")
                x1 = evalstring(nth(1 nextline))
                fprintf( outport, "\"")
                fprintf( outport, "%n", x1)
                fprintf( outport, "\" ")
                y1 = evalstring(nth(2 nextline))
                fprintf( outport, "\"")
                fprintf( outport, "%n", y1)
                fprintf( outport, "\" ")
                rot = evalstring(nth(3 nextline))
                fprintf( outport, "\"")
                fprintf( outport, "%n", rot)
                fprintf( outport, "\" ")
                mirrorside = cdr(nextline)
                mirrorside = cdr(mirrorside)
                mirrorside = cdr(mirrorside)
                mirrorside = cdr(mirrorside)
                mirrorside = car(mirrorside)
                fprintf( outport, "\"")
                fprintf( outport, "%s", mirrorside)
                fprintf( outport, "\" ")
                fprintf( outport, "\n")
; Counter that reports the number of records created
                count=count+1
                if( eq(count 100) then
                  printf("\n%n%s\n" , count2, " Records Generated.")
                  drain(poport)
                  count=0
                  count2=count2+100
                ) ; end of if
        ) ; end of while
) ; end of when
fprintf( outport ,".End\n")
; Writes the final component count to the log window
count2=count2+count
printf("\n%n%s\n" , count2, " Records Generated.")

close( inport)
close( outport)
)
; Register pickdata program in Allegro
axlCmdRegister( "pickdata" `pickdata)
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
收藏收藏2 支持!支持! 反对!反对!

172

主题

733

帖子

-7486

积分

未知游客(0)

积分
-7486
2#
 楼主| 发表于 2012-4-9 16:24 | 只看该作者
100 Records Generated.
E- *Error* close: argument #1 should be an I/O port (type template = "p") - nil

出错信息

7

主题

41

帖子

372

积分

三级会员(30)

Rank: 3Rank: 3Rank: 3

积分
372
3#
发表于 2012-4-9 16:40 | 只看该作者
没有skill_extract_pickdata.txt文件

172

主题

733

帖子

-7486

积分

未知游客(0)

积分
-7486
4#
 楼主| 发表于 2012-4-9 16:55 | 只看该作者
wikiy 发表于 2012-4-9 16:40
没有skill_extract_pickdata.txt文件

这个文件是什么怎么获得?

7

主题

41

帖子

372

积分

三级会员(30)

Rank: 3Rank: 3Rank: 3

积分
372
5#
发表于 2012-4-9 17:15 | 只看该作者
这个文件是程序自动导出的,这里有可能是导出文件出错,导致后面在输入这个文件时端口为空,最后在close时报错

117

主题

2352

帖子

1万

积分

EDA365特邀版主

Rank: 6Rank: 6

积分
13799

最佳敬业奖

6#
发表于 2012-4-9 17:48 | 只看该作者
szc1983 发表于 2012-4-9 16:55
这个文件是什么怎么获得?

;已修改

;           Creates a file with pick and place data that can be
;                backannotated into Capture/Capture CIS
;           ------------------------------------------
;
;                The program runs from the open allegro board
;
;                To run the program type "pickdata" on the Allegro
;                command line
;
;                The program extracts the following properties into a file  
;                pickdata.swp
;                REF_DES                : Reference Designator
;                SYM_CENTER_X        : Components center x-origin (BODY_CENTER)
;                SYM_CENTER_Y        : Components center y-origin (BODY_CENTER)
;                SYM_ROTATION        : Components rotation
;                SYM_MIRROR                : YES if component is mirror, otherwise NO
;
;                The properties are backannotated into the following properties  
;                in Capture. The properties can be renamed, look in the code.
;                REF_DES                : Does not get back into Capture but is used
;                                        : to find the correct component to update
;                SYM_CENTER_X        : Pick_X
;                SYM_CENTER_Y        : Pick_Y
;                SYM_ROTATION        : Pick_Rotation
;                SYM_MIRROR                : Pick_Mirror
;
;                USAGE :
;                1. Open board in Allegro (make sure the skill program pickdata.il
;                         is loaded
;                2. Write pickdata at the prompt and press ENTER to generate file  
;                3. The file is called pickdata.swp - it is placed in the current  
;                        directory
;                4. In Capture - open the correct project
;                5. Tools - Backannotate
;                6. Select the Layout tab
;                7. Browse and select the pickdata.swp file
;                8. Press OK and look in the session log to see that all is well
;                9. Now open the schematic design and look at properties on parts
;                10. The pick and place data can now be included in reports                 
;
;
; To run the program type "pickdata" on the Allegro  
; command line.
; -----------------------------------------------------------------
; Tested on Allegro 14.1
; The program is delivered as is and no responisibility is taken.
; Use at own risk

; Written by:

; Ole Ejlersen
; Technical Service Manager
; Nordcad Systems A/S - Representing Cadence in Denmark
; I can be reached at the following address:
; E-Mail: oe@nordcad.dk
; -----------------------------------------------------------------  

(defun pickdata ()

extract1_exists = nil
drain(poport)
new_name = axlCurrentDesign()
; Create extract command file
outport = outfile("skill_extract_views.txt")
fprintf( outport , "%s\n\n%s\n%s\n%s\n%s\n%s\n\n%s\n%s\n%s\n%s\n%s\n\n%s\n" ,  
                                        "COMPONENT" ,   
                                        "REFDES != ''" , "SYM_CENTER_X != ''" ,  
                                        "SYM_CENTER_Y != ''" , "SYM_ROTATE != ''" , "SYM_MIRROR != ''" ,
                                        "REFDES" , "SYM_CENTER_X" , "SYM_CENTER_Y" ,
                                        "SYM_ROTATE" , "SYM_MIRROR" , "END")
close( outport)
;extract data from board with extract file
;extract1 = strcat("extract -s -q " new_name " skill_extract_views skill_extract_pickdata")
;shell( extract1 )
axlExtractToFile( "skill_extract_views" "skill_extract_pickdata")

inport = infile("skill_extract_pickdata.txt")
outport = outfile("pickdata.swp")

;Generate header for swap file
fprintf(outport , ";**************************************************\n")
fprintf(outport , ";Backannotation file with pick and place data\n")
fprintf(outport , ";from Cadence Allegro to Capture and Capture CIS\n")
fprintf(outport , ";**************************************************\n")
fprintf( outport , ".Section3 UpdateProperties Parts\n")
;If you want the pick and place data backannotated to other property names than the default
;then you need to change the names in the next line
fprintf( outport , "\"{Reference}\" \"Pick_X\" \"Pick_Y\" \"Pick_Rotation\" \"Pick_Mirror\"\n")
;shell(extract1)
count = 0
count2 = 100
when( inport
        while(gets( nextline inport)
                nextline = parseString(nextline "!")
                                println(nextline)
                                when(car(nextline) == "S"
                                        refdes = nth(1,nextline)
                                        fprintf( outport, "\"")
                                        fprintf( outport, "%s", refdes)
                                        fprintf( outport, "\" ")
                                        x1 = atof(nth(2 nextline))
                                        fprintf( outport, "\"")
                                        fprintf( outport, "%n", x1)
                                        fprintf( outport, "\" ")
                                        y1 = atof(nth(3 nextline))
                                        fprintf( outport, "\"")
                                        fprintf( outport, "%n", y1)
                                        fprintf( outport, "\" ")
                                        rot = atof(nth(4 nextline))
                                        fprintf( outport, "\"")
                                        fprintf( outport, "%n", rot)
                                        fprintf( outport, "\" ")
                                        mirrorside = nth(5,nextline)
                                        fprintf( outport, "\"")
                                        fprintf( outport, "%s", mirrorside)
                                        fprintf( outport, "\" ")
                                        fprintf( outport, "\n")
        ; Counter that reports the number of records created
                                        count=count+1
                                        if( eq(count 100) then
                                          printf("\n%n%s\n" , count2, " Records Generated.")
                                          drain(poport)
                                          count=0
                                          count2=count2+100
                                        ) ; end of if
                                )
        ) ; end of while
) ; end of when
fprintf( outport ,".End\n")
; Writes the final component count to the log window
count2=count2+count
printf("\n%n%s\n" , count2, " Records Generated.")

close( inport)
close( outport)
)
; Register pickdata program in Allegro
axlCmdRegister( "pickdata" `pickdata)
谁画出这天地 又画下我和你

8

主题

209

帖子

2752

积分

四级会员(40)

Rank: 4Rank: 4Rank: 4Rank: 4

积分
2752
7#
发表于 2012-4-9 19:36 | 只看该作者
请问:适用于哪里?

172

主题

733

帖子

-7486

积分

未知游客(0)

积分
-7486
8#
 楼主| 发表于 2012-4-10 09:11 | 只看该作者
mako88 发表于 2012-4-9 19:36
请问:适用于哪里?

应该是把pcb中的symbol坐标信息反标到原理图,这样修改原理图中的reference,pcb中的器件不会因为改了ref乱飞

172

主题

733

帖子

-7486

积分

未知游客(0)

积分
-7486
9#
 楼主| 发表于 2012-4-10 09:13 | 只看该作者
再次感谢版主大牛

8

主题

209

帖子

2752

积分

四级会员(40)

Rank: 4Rank: 4Rank: 4Rank: 4

积分
2752
10#
发表于 2012-4-10 13:01 | 只看该作者
szc1983 发表于 2012-4-10 09:11
应该是把pcb中的symbol坐标信息反标到原理图,这样修改原理图中的reference,pcb中的器件不会因为改了ref ...

哦,这样啊!谢谢哦!你也挺牛的!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

推荐内容上一条 /1 下一条

巢课

技术风云榜

关于我们|手机版|EDA365 ( 粤ICP备18020198号 )

GMT+8, 2024-10-23 19:30 , Processed in 0.098040 second(s), 34 queries , Gzip On.

深圳市墨知创新科技有限公司

地址:深圳市南山区科技生态园2栋A座805 电话:19926409050

快速回复 返回顶部 返回列表