#1
|
|||
|
|||
BOM Table to Text File
Can anyone have a LISP program that reads the Current BOM table within Solid Designer – Annotation and outputs a ASCII CSV file?
I would welcome any help. Thanks |
#2
|
|||
|
|||
Exporting AM BOM to file
Yes John, I wrote such a program for a customer of mine, but
I am not authorized to send it to you... anyway, I'll try to explain you the steps I followed. -First of all, you have to retrieve the logical table that contains the data you want to write to the file: (setq ltab (sd-get-display-table-logical-table "AM-BOM-DATA-DTAB")). "AM-BOM-DATA-DTAB" is the AM BOM display table name, and, after this call, you'll have the BOM data into the logical table ltab. -Now you have to retrieve the fields of the logical table that are shown into the display table: in fact the logical table usually contains much more information that the one you see in the display table. Probably the global variable DOCU::*DOCU-REGISTERED-BOM-ATTRS* is a good starting point: it contains a list of lists, each sublist represents a single registered BOM attribute in the format (attr-type attr-title attr-visible) -Now you have to read the contents of the logical table ltab, according to the information you retrieved at the previous step. To do this you can use the documented function (sd-read-logical-table-cell) -Finally, write the data to the file. Hope this helps. Fabrizio |
#3
|
||||
|
||||
Re: BOM Table to Text File
Quote:
Code:
LET l_win (GET_CURRENT_WINDOW) LET l_bom_ltab Awm_bed_f_get_local_bom_ltab l_win LET l_head_ltab Awm_bed_f_get_local_head_ltab l_win LET l_head_name (READ_LTAB l_head_ltab 1 db_default_name) LET l_file (FIX_MESG "{1}\{2}.csv" (READ_ENV "TEMP") l_head_name) Awm_na_m_register_shut_action (FIX_MESGQ "PURGE_FILE {1} CONFIRM" l_file) LTAB_TO_TABSL l_bom_ltab DEL_OLD l_file LET r (SHELL_EXECUTE "open" l_file "" "") |
#4
|
||||
|
||||
Hi John
as you are not using WM/DDM, the only way to access this table is some LISP code (as Fabrizio pointed it out) Beats me why CoC can't provide a button for exporting the table e.g. into a file or HTML. Shouldn't be such a big deal for them. Unfortunately, I don't have such LISP code at hand (at the moment) Chris Last edited by ChrisE; 03-12-2003 at 08:34 AM. |
#5
|
||||
|
||||
Code:
(defun sd-logical-table-contents-to-csv (ltab fname) (when(sd-logical-table-p ltab) (let (row) (with-open-file (fo fname :direction :output) (dotimes (i (sd-get-logical-table-number-of-rows ltab)) (setf row (sd-read-logical-table-row ltab :row i)) (format fo "~A~{,~A~}~%" (car row) (rest row))))))) I could not test it!, because I don't have an OSD at home !! I'm thinking about to post some small functions during the next days... |
#6
|
||||
|
||||
That's the piece of code I didn't have at hand right away. Thank you, Wolfgang.
So I was curious to test his algorithm. It worked right away . However, I enhanced it a bit I put it all together into a small LISP program, that will add a new button "Print Bom" to the toolbox. Within the then called dialog you can choose the destination CSV file. Upon pressing OK, the bom table will be read out, and written to the file of your choice. When you are on Windows, the file will also directly be loaded into the appropriate application (like e.g. MS Excel) Please find a sample program attached. Have fun |
#7
|
|||
|
|||
Thank you
Chris Thank you for you help with the lisp program, it worked well
|
#8
|
|||
|
|||
How do you "run" a lisp program like this?
Steve |
#9
|
||||
|
||||
Quote:
Code:
(load "filename.lsp") Code:
(load "C:/path/filename.lsp")
__________________
John Scheffel |
#10
|
|||
|
|||
Hi Steve,
In addition to the methods John mentioned, you can also just drag and drop the lisp file into your active Modeling session (this option may be easier in many cases than typing at the command line). After the lisp file is loaded, the function will be available in your toolbox. If you want it on a toolbar, you can create a new command and bitmap for it, and add that new bitmap and command to any toolbar you wish. If you'd like more info on how to do this, feel free to drop me a line or just reply to this post... If you want the file to be loaded each time you start Designer Modeling, just add the line already mentioned by John i.e. (load "C:/path/filename.lsp") to your startup file (normally pesd_customize, though with V12 it will typically be just sd_customize...) I hope this helps! andy
__________________
Andy Poulsen AI MAXTools: Dream. Design. Done. It's that easy! Add-ins bringing new functionality and speed to Creo Elements/Direct and CoCreate products. Now available for v17-v20+! See them in action at www.ai-maxtools.com and then try them for yourself -- FREE! |
#11
|
||||
|
||||
For anyone who is interested in data management capabilities, even though this is a Designer Modeling thread, Model Manager has the feature of exporting BOM tables to CSV, HTML or Excel. The BOM tables come directly from assembly structures saved with MM. Once saved, they can be exported as is or manually massaged for manufacturing purposes and then rev’d for tracking.
__________________
David@CoCreate |
#12
|
|||
|
|||
Well, I tried running the above bom.lsp file, by dragging and dropping it into SD.
When I ran the program, it came back with the following error: A display table with name "AM-BOM-DATA-DTAB" does not exist. I'm running 11.60C. Does anyone know a simple way to get a printed (or text file) BOM out of SD/WM? Steve |
#13
|
|||
|
|||
@Steve:
just a guess: was Annotation loaded when you ran the program? If I am not wrong, the display table that is mentioned in the error msg is defined only when you load Annotation... Fabrizio |
#14
|
|||
|
|||
Hi Steve,
We are going to be releasing a freeware module in the near future that includes this functionality. I extracted the relevant code from our development code stream and did a quick check on it, and believe it does what you are looking for. It's a bit different than the other solutions mentioned in that it doesn't require Annotation to be loaded just to get a BOM of items in your active session. Since the module in question is going to be freeware, I can make this publicly available (keep in mind it's PRE-RELEASE but has been fairly well tested!). I have attached a zip file that contains a compiled version (i.e. .dll file for windows) of this function. Please take a look and see if it does what you want! Quick Overview of AI-BOM: AI-BOM allows you to specify which assemblies to include (i.e. either all objects or selected objects) for your Bill Of Material. It also gives you several choices for how you want the data displayed/written (including being able to get more detail on which parts are common, including pathnames). The resulting BOM can be displayed on the screen, and also can be saved to disk as either a .csv file or in a tabular .txt file that will look nice (when displayed in a fixed-width font, obviously!) Please give it a look and let me know if this fits your needs. Also, if you think of any other features you would find useful, please pass those along as well. We'd love to hear any input you have! Good luck! andy NOTE: the attachment that was here has been deleted, and an updated version has been posted in a later message in this thread. It includes versions compatible with both SolidDesigner 9 and OneSpace Designer Modeling 11+.
__________________
Andy Poulsen AI MAXTools: Dream. Design. Done. It's that easy! Add-ins bringing new functionality and speed to Creo Elements/Direct and CoCreate products. Now available for v17-v20+! See them in action at www.ai-maxtools.com and then try them for yourself -- FREE! Last edited by Andy Poulsen; 01-28-2004 at 11:48 AM. |
#15
|
|||
|
|||
Interesting. I just tried it on SD9.01D and I get the attached LISP error. Does it need OSD11 at a minimum to work?
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|