• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Allegro X PCB Editor
  3. Skill function to retrieve ptf entries

Stats

  • Replies 0
  • Subscribers 159
  • Views 12621
  • Members are here 0
More Content

Skill function to retrieve ptf entries

archive
archive over 20 years ago

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
  • Sign in to reply
  • Cancel
Cadence Guidelines

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information