Home > Community > Forums > PCB SKILL > Skill function to retrieve ptf entries

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Skill function to retrieve ptf entries 

Last post Fri, Mar 18 2005 7:39 AM by archive. 0 replies.
Started by archive 18 Mar 2005 07:39 AM. Topic has 0 replies and 1957 views
Page 1 of 1 (1 items)
Sort Posts:
  • Fri, Mar 18 2005 7:39 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,910
    Skill function to retrieve ptf entries Reply

    Hi all,

    to get things started, I attached a skill function I recently wrote. This function returns key and injected properties of the ptf table of a given component and property object set and can be used to verify that the properties attached to the given component match the key properties in the assoc. part table file. As you know this this will result in an error during packageing if these don't match....

    Andy

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;; ARGUMENTS:
    ;; chandle - is a hande to concepthdl
    ;; compObj - is a component object
    ;; the following would return one such thing
    ;; (setq cmdRetObj (cnSendCommand cnh "find 4rnet" ?runOptions verbose) )
    ;; (setq group (cnGetGroupName cmdRetObj))
    ;; (csFreeGroup cnh group)
    ;; (setq primObjSet (cnGetGroupedObjectSet cmdRetObj))
    ;; (setq compObjSet (cnGetComps primObjSet))
    ;; (setq compObj (car compObjSet))
    ;; propObjSet - list property objects attached to component
    ;; can be retrieved using csGetComponentProps(cnh compObj)
    ;; RETURNS:
    ;; -1 : indicates that there was an error retrieving the part_table view object
    ;; this usually mean sthat there is no part_table file
    ;; -2 : indicates that not all keyproperties where found in the propObjSet
    ;; nil : if the properties of the passed propObjSet cannot be matched with the key
    ;; properties
    ;; list : a list containing a list of key properties and a list of injected properties
    ;; and their values
    ;; Example:
    ;; AK_cnGetCompPtfProps(cnh, compObj, propObjSet)
    ;; (
    ;; (("VALUE" "100/187/100")
    ;; ("LTX_RATING" "1/16W")
    ;; ("POSTOL" "1%")
    ;; ("PART_NUMBER" "166-0061-00")
    ;; ("PACK_TYPE" "4RNET")
    ;; ("TC" "200PPM")
    ;; )
    ;; (("STATUS" "C")
    ;; ("PART_NUMBER" "166-0061-00")
    ;; ("JEDEC_TYPE" "CANET16")
    ;; ("DEVICE_LABEL" "RN")
    ;; ("HEIGHT" "10")
    ;; ("SIGNAL_MODEL" "4RNET_166-0061-00")
    ;; )
    ;; )
    ;;
    (procedure AK_cnGetCompPtfProps(chandle, compObj, propObjSet)
    prog( (comp_name comp_lib viewsInfoObj ptfview filepath ptf_line i msgs
    iport char1 ptf_prop_line propList valueList found_kps
    keyprops injprops prop keyvalues injvalues val kval read_lines
    kvalueList jvalueList)

    (setq compName (cnGetCompName compObj))
    (setq compLib (cnGetCompLibName compObj))
    (setq compDbId (cnGetCompDbId compObj))
    viewsInfoObj = cnlGetViewInfo(cnh list( list(compLib compName "part_table") ) )

    (setq msgs (cnGetMsgs (cnGetMsgInfo viewsInfoObj)))
    (if msgs != nil then
    (return -1)
    else
    ptfview = car(cnlGetViews(viewsInfoObj))
    filepath = cnlGetViewFilePath(ptfview)
    sprintf( masterfile "%s/master.tag" filepath)
    iport = infile(masterfile)
    fscanf( iport "%s" ptffile)
    close(iport)
    sprintf( file "%s/%s" filepath, ptffile)
    iport = infile(file)

    (while (gets line iport)
    (if (rexMatchp "[a-zA-Z0-9]+" line) then
    (setq read_lines (rexMatchp "[|]" line))
    (setq char1 (substring line 1 1))

    ;; replace multiple spaces with one space
    rexCompile(" +")
    (setq ptf_line (rexReplace line " " 0))
    ;; replace all " | " with "|"
    rexCompile(" | ")
    (setq ptf_line (rexReplace ptf_line "|" 0))
    (rexCompile " ;\n")
    (setq ptf_line (rexReplace ptf_line "" 0))
    (if char1 == ":" then
    (setq read_lines t)
    (rexCompile "(OPT='[a-zA-Z]*')")
    (setq keyprops (parseString
    (rexReplace
    (substring
    (substring ptf_line 1 ((nindex ptf_line " = ") - 1) )
    2
    );substring
    ""
    0
    );rexReplace
    "|"
    );parseString
    );setq

    (setq injprops (parseString
    (rexReplace

    (substring ptf_line ((nindex ptf_line " = ") + 3) )

    ""
    0
    );rexReplace
    "|"
    );parseString
    )
    ;;printf("\n%L\n%L\n\n" keyprops, injprops)
    (setq valueList nil)
    (setq found_kps 0)
    (foreach prop keyprops
    (foreach propObj propObjSet
    (setq propName (cnGetPropName propObj))
    (setq propValue (cnGetPropValue propObj))
    (if propName == prop then
    (setq found_kps (found_kps + 1))
    (setq valueList (append1 valueList propValue))
    );if
    );foreach
    );foreach
    ;;(printf "%d %d \n%L\n" (length keyprops), found_kps, valueList)
    (if (length keyprops) != found_kps then
    close(iport)
    (setq propList -2)
    );if
    ;;;;;; ELSE ;;;;;;;;;;
    else
    (if read_lines then
    (setq keyvalues (parseString
    (rexReplace
    (substring
    (substring ptf_line 1 ((nindex ptf_line " = ") - 1) )
    2
    );substring
    ""
    0
    );rexReplace
    "|"
    );parseString
    )
    (setq injvalues (parseString
    (rexReplace

    (substring ptf_line ((nindex ptf_line " = ") + 3) )

    ""
    0
    );rexReplace
    "|"
    );parseString
    )
    ;;printf("%L\n%L\n%L\n%L\n\n" valueList, ptf_line, keyvalues, injvalues)
    (setq found_kps t)
    (for i 0 ((length keyvalues) - 1)
    (setq val (nth i valueList))
    (setq kval (substring (nth i keyvalues) 2))
    (setq kval (substring kval 1 ((nindex kval "'") - 1)))
    (if kval != val then
    (setq found_kps nil)
    );if
    );for
    (if found_kps then
    (setq jvalueList nil)
    (setq kvalueList nil)
    (for i 0 ((length injvalues) - 1)
    (setq val (substring (nth i injvalues) 2))
    (setq val (substring val 1 ((nindex val "'") - 1)))
    rexCompile("\n")
    (setq val (rexReplace val "" 0))
    (setq jvalueList (append1 jvalueList val))
    );for
    (for i 0 ((length keyvalues) - 1)
    (setq val (substring (nth i keyvalues) 2))
    (setq val (substring val 1 ((nindex val "'") - 1)))
    rexCompile("\n")
    (setq val (rexReplace val "" 0))
    (setq kvalueList (append1 kvalueList val))
    );for
    (setq propList
    (list
    (mapcar 'list keyprops kvalueList)
    (mapcar 'list injprops jvalueList)
    )
    )
    );
    );
    );if char1 == ":"
    );
    );while
    close(iport)
    (return propList)
    );if
    );prog
    );procedure


    Originally posted in cdnusers.org by andyk
    • Post Points: 0
Page 1 of 1 (1 items)
Sort Posts:
Started by archive at 18 Mar 2005 07:39 AM. Topic has 0 replies.