Hello All,
What I'm currently trying to do is to use the User Post (3) funcationality to set it up such that sub assemblies for a panel footprint will have the same item number as the master footprint. basically I want to copy the main Item number into the blanks for the sub-assemblies. I've tried writing this code in the file bompnl.lsp:
(if (= user_3 "1")
(progn
(setq newdatalst nil)
(foreach lst combined_data
(setq y (nth 0 lst))
(if (/= y "")(setq itm y)) ; If ITEM is not blank, then it's the main assembly, copy the value
;(if (OR (not itm)(= itm ""))(setq itm "1"))
; Convert value to text string
(setq str (rtos itm 2 0)) ; convert to string decimal
; Substitute value back into the ITEM field
(setq lst (wd_nth_subst 0 str lst))
(setq newdatalst (cons lst newdatalst))
)
(setq combined_data (reverse newdatalst)) ; put back in original order
)
)
This is currently giving me an error that says: Error: bad argument type: numberp: "1"
I'm guessing that the problem is the code where the new item number is written back into the list:
(setq str (rtos itm 2 0)) ; convert to string decimal
; Substitute value back into the ITEM field
(setq lst (wd_nth_subst 0 str lst))
I've attached the entire lsp file for help. Thanks everyone!