AutoCAD Electrical Forum
Welcome to Autodesk’s AutoCAD Electrical Forums. Share your knowledge, ask questions, and explore popular AutoCAD Electrical topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom Panel BOM User Post Issue

0 REPLIES 0
Reply
Message 1 of 1
matthewjohnston4386
469 Views, 0 Replies

Custom Panel BOM User Post Issue

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!

 


 

Matthew Johnston
Sr. Controls Scientist
Corning Inc.
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost