Professional Documents
Culture Documents
Export Altium Placement
Export Altium Placement
case(EAP_form->curField
("btnpnp"
EAP_path_pnp = axlDMFileBrowse( "txt File" nil ?defaultName "" ?
noDirectoryButton t ?noSticky t ?title "Select Altium PnP File" ?optFilters "Pick
and place(*.txt)|*.txt|")
if(EAP_path_pnp != nil then
;CL_InFile = infile(EAP_path_pnp)
axlFormSetField(EAP_form "txtpnp" EAP_path_pnp)
);end-if
) ; end btnpnp
("btnlist"
EAP_path_list = axlDMFileBrowse( "list File" nil ?defaultName
"" ?noDirectoryButton t ?noSticky t ?title "Select List symbols File" ?optFilters
"List File(*.lst)|*.lst|")
if(EAP_path_list != nil then
;CL_InFile = infile(EAP_path_list)
axlFormSetField(EAP_form "txtlist" EAP_path_list)
);end-if
) ; end btnlist
("btnout"
EAP_path_out = axlDMFileBrowse( "txt File" t ?defaultName "" ?
noDirectoryButton t ?noSticky t ?title "Save output file as" ?optFilters "Pick and
place(*.txt)|*.txt|")
if(EAP_path_out != nil then
;CL_InFile = infile(EAP_path_out)
axlFormSetField(EAP_form "txtout" EAP_path_out)
);end-if
) ; end btnout
("btncreate"
;check input file
EAP_checkInput();
case(EAP_stt
("EPNP"
println("Please select PnP file!!!")
)
("ELIST"
println("Please select List Symbols file!!!")
)
("EOUT"
println("Please select Output file!!!")
)
("NOT_PNP"
println("Incorrect header PnP file!!!")
)
("OK"
;println("Input file OK!!!")
;check Altium pnp file header
EAP_InListFile = infile(EAP_path_list)
EAP_NotFound_Refdes = nil
EAP_Found_Refdes = nil
EAP_Not_Found_Count = 0
EAP_Found_Count = 0
EAP_Refdes_t = nil
Found_Count = 0;
Not_Found_Count = 0;
EAP_Get_AllRefdes(); get refdes from PnP file
);end-if
);end-while
);end-if
;println(EAP_NotFound_Refdes)
;println(Not_Found_Count)
;println(EAP_Found_Refdes)
;println(Found_Count)
close(EAP_InListFile)
EAP_PrintFile()
println("Export completed!!!")
printf("%d components exported\n" Found_Count)
printf("%d components not found\n" Not_Found_Count)
;println(EAP_Found_Refdes)
;println(Found_Count)
);end case
);end-btncreate
);end-case
);end-defun
;----------------------------------------------------------------------
defun( EAP_checkInput ()
EAP_stt = "OK"
EAP_AllRefdes = nil
if( EAP_path_out == nil then EAP_stt = "EOUT")
if( EAP_path_list == nil then EAP_stt = "ELIST")
if( EAP_path_pnp == nil then EAP_stt = "EPNP")
);end-if
if(EAP_stt == "OK" then
EAP_Refdes_t1 = parseString(EAP_Refdes_t1 " \n\t")
EAP_Refdes_t1 = car(EAP_Refdes_t1) ;refdes
EAP_AllRefdes = cons(EAP_Refdes_t1 EAP_AllRefdes)
);end-if
);end-while
EAP_AllRefdes = sort(EAP_AllRefdes nil)
;println("EAP_AllRefdes")
;println(EAP_AllRefdes)
close(EAP_InPnPFile)
)
); end EAP_checkInput
defun( EAP_PrintFile ()
EAP_AllRefdes = nil
EAP_AllDataOut = nil
EAP_DataList = nil
EAP_DataListOut = nil
EAP_OutOutFile = outfile(EAP_path_out)
fprintf(EAP_OutOutFile "Altium Designer Pick and Place Locations\n")
fprintf(EAP_OutOutFile "Units used: mil\n\n")
fprintf(EAP_OutOutFile "Designator Comment Layer Center-X(mil) Center-Y(mil)
Rotation\n")
("0"
EAP_Data_t = axlFormGetField( EAP_form
"cbx_0")
)
("90"
EAP_Data_t = axlFormGetField( EAP_form
"cbx_90")
)
("180"
EAP_Data_t = axlFormGetField( EAP_form
"cbx_180")
)
("270"
EAP_Data_t = axlFormGetField( EAP_form
"cbx_270")
)
("360"
EAP_Data_t = axlFormGetField( EAP_form
"cbx_360")
)
);end-case
);end-if
if(EAP_str_t == "" then
EAP_str_t = EAP_Data_t
else
EAP_str_t = strcat(EAP_str_t " " EAP_Data_t)
);end-if
);end-foreach
fprintf(EAP_OutOutFile EAP_str_t)
fprintf(EAP_OutOutFile "\n")
;EAP_AllDataOut = cons(EAP_str_t EAP_AllDataOut)
);end-if
);end-foreach
;println(EAP_AllRefdes)
close(EAP_OutOutFile)
);end-defun
defun( EAP_Get_AllRefdes ()
EAP_InPnPFile = infile(EAP_path_pnp)
EAP_AllData = nil
EAP_AllRefdes = nil
EAP_stt = "NOT_PNP"
);end-if
defun( EAP_Form_Build ()
;deleteFile(EAP_FORMFILE)
EAP_FORMFILE = outfile(EAP_form)
fprintf(EAP_FORMFILE "FILE_TYPE=FORM_DEFN VERSION=2\n")
fprintf(EAP_FORMFILE "FORM\n")
fprintf(EAP_FORMFILE "FIXED\n")
fprintf(EAP_FORMFILE "PORT 38 1\n")
fprintf(EAP_FORMFILE "HEADER \"Altium Placement PnP File\"\n")
fprintf(EAP_FORMFILE "\n")
fprintf(EAP_FORMFILE "POPUP
<degree>\"0\" \"0\", \"90\" \"90\", \"180\" \"180\", \"270\" \"270\" , \"360\" \"36
0\"\n")
fprintf(EAP_FORMFILE "TILE\n")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
fprintf(EAP_FORMFILE "TEXT \"PnP File:\"\n")
fprintf(EAP_FORMFILE "TLOC 1 1\n")
fprintf(EAP_FORMFILE "ENDTEXT\n\n")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
fprintf(EAP_FORMFILE "TEXT \"List File:\"\n")
fprintf(EAP_FORMFILE "TLOC 1 3\n")
fprintf(EAP_FORMFILE "ENDTEXT\n\n")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
fprintf(EAP_FORMFILE "TEXT \"Out File:\"\n")
fprintf(EAP_FORMFILE "TLOC 1 5\n")
fprintf(EAP_FORMFILE "ENDTEXT\n\n")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
fprintf(EAP_FORMFILE "TEXT \"0* : ==>>>\"\n")
fprintf(EAP_FORMFILE "TLOC 5 8\n")
fprintf(EAP_FORMFILE "ENDTEXT\n\n")
fprintf(EAP_FORMFILE "FIELD cbx_0\n")
fprintf(EAP_FORMFILE "FLOC 15 8\n")
fprintf(EAP_FORMFILE "STRFILLIN 3 3 \n")
fprintf(EAP_FORMFILE "POP \"degree\" \n")
fprintf(EAP_FORMFILE "ENDFIELD\n")
fprintf(EAP_FORMFILE "\n")
fprintf(EAP_FORMFILE "ENDTILE\n")
fprintf(EAP_FORMFILE "\n")
fprintf(EAP_FORMFILE "ENDFORM\n")
close( EAP_FORMFILE)
);end-defun