CoCreate User Forum  

Go Back   CoCreate User Forum > Applications > CoCreate Modeling

Reply
 
Thread Tools Search this Thread Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1  
Old 03-10-2003, 02:52 AM
John Lock John Lock is offline
Junior Member
 
Join Date: Mar 2003
Posts: 2
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
Reply With Quote
  #2  
Old 03-10-2003, 11:42 PM
fabrizio fabrizio is offline
Registered User
 
Join Date: Jan 2003
Location: Parma - Italy
Posts: 34
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
Reply With Quote
  #3  
Old 03-11-2003, 10:13 AM
ChrisE's Avatar
ChrisE ChrisE is offline
OneSpace Member
 
Join Date: Oct 2002
Location: Grünstadt, Pfalz, Germany
Posts: 121
Re: BOM Table to Text File

Quote:
Originally posted by John Lock
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
Are you using DDM/WM Desktop ? If so, you could define a macro behind a push button in the WM Bom editor/viewer doing the following (I supplied you with a simple version):

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 "" "")
This will take the entire bom ltab (unformatted, with all columns) directly to Excel.
Reply With Quote
  #4  
Old 03-12-2003, 08:32 AM
ChrisE's Avatar
ChrisE ChrisE is offline
OneSpace Member
 
Join Date: Oct 2002
Location: Grünstadt, Pfalz, Germany
Posts: 121
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.
Reply With Quote
  #5  
Old 03-12-2003, 11:59 AM
Wolfgang's Avatar
Wolfgang Wolfgang is offline
Registered User
 
Join Date: Nov 2002
Location: ... near Sindelfingen near Stuttgart, Germany
Posts: 754
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)))))))
look's like lisp :)

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...
Reply With Quote
  #6  
Old 03-12-2003, 02:22 PM
ChrisE's Avatar
ChrisE ChrisE is offline
OneSpace Member
 
Join Date: Oct 2002
Location: Grünstadt, Pfalz, Germany
Posts: 121
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
Attached Files
File Type: lsp bom.lsp (1.7 KB, 1350 views)
Reply With Quote
  #7  
Old 03-27-2003, 04:53 AM
John Lock John Lock is offline
Junior Member
 
Join Date: Mar 2003
Posts: 2
Thumbs up Thank you

Chris Thank you for you help with the lisp program, it worked well
Reply With Quote
  #8  
Old 01-09-2004, 12:39 PM
Steve Steve is offline
Registered User
 
Join Date: Mar 2003
Location: Alabama
Posts: 309
How do you "run" a lisp program like this?

Steve
Reply With Quote
  #9  
Old 01-09-2004, 02:01 PM
John Scheffel's Avatar
John Scheffel John Scheffel is offline
Administrator
 
Join Date: Sep 2002
Location: San Jose, CA
Posts: 1,288
Quote:
Originally posted by Steve
How do you "run" a lisp program like this?
You can run a LISP file by loading it. From the Load File browser, you can go to the folder containing the file, set the file type to LISP Source (*.lsp), pick the file and load it. On the command line you can use a command such as:
Code:
(load "filename.lsp")
provided the file is in the current folder. If not, you will need to include a path such as:
Code:
(load "C:/path/filename.lsp")
Note the use of forward slashes (UNIX syntax) rather than back slashes (Windows syntax). In SolidDesigner or Modeling the forward slash will work for either OS.
__________________
John Scheffel
Reply With Quote
  #10  
Old 01-09-2004, 04:26 PM
Andy Poulsen Andy Poulsen is offline
Administrator
 
Join Date: Apr 2003
Location: Fort Collins, Colorado
Posts: 273
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!
Reply With Quote
  #11  
Old 01-12-2004, 11:52 AM
dszostak's Avatar
dszostak dszostak is offline
Registered User
 
Join Date: Oct 2002
Location: Boston, MA
Posts: 292
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
Reply With Quote
  #12  
Old 01-13-2004, 06:24 AM
Steve Steve is offline
Registered User
 
Join Date: Mar 2003
Location: Alabama
Posts: 309
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
Reply With Quote
  #13  
Old 01-13-2004, 11:09 PM
fabrizio fabrizio is offline
Registered User
 
Join Date: Jan 2003
Location: Parma - Italy
Posts: 34
@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
Reply With Quote
  #14  
Old 01-14-2004, 12:26 AM
Andy Poulsen Andy Poulsen is offline
Administrator
 
Join Date: Apr 2003
Location: Fort Collins, Colorado
Posts: 273
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.
Reply With Quote
  #15  
Old 01-14-2004, 10:20 AM
May Kung May Kung is offline
Registered User
 
Join Date: Oct 2002
Location: San Jose, CA
Posts: 301
Interesting. I just tried it on SD9.01D and I get the attached LISP error. Does it need OSD11 at a minimum to work?
Attached Thumbnails
Click image for larger version

Name:	lisp_frame_error.jpg
Views:	866
Size:	10.8 KB
ID:	220  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 07:43 AM.



Hosted by SureServer    Forums   Modeling FAQ   Macro Site   Vendor/Contractors   Software Resellers   CoCreate   Gallery   Home   Board Members   Regional User Groups  By-Laws  

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
You Rated this Thread: