Reply

Embedded Excel Worksheets / BOM

[ Edited ]

 

I regularly visit your site, and have recommended it to others. As far as Solid Edge, this is THE site to get help from. Great Job to all!

I have never been able to get a fully successful BOM from Solid Edge. I was using recursion and the occurances object, and was semi-successful, but the Excel worksheets (SmartFrames2d), that at least for us, hold the part materials and thier qty per parent, have been elusive. I believe it to be an Excel issue...  the dreaded "call was rejected by callee" error telling me that Excel is still busy with its last job...   Then I came across the SEPartReader.dll and WOW, how much easier and quicker it is for getting occurances. Works great and I am thrilled. But....   using DraftDataAPI.dll to get the sheet data only seems to get a picture of the data (emf file). Is there a way to get the Excel worksheet data without opening Excel within Solid Edge? Am including the (working) code for occurances and the draft emf in case anyone else is interested in it  Thanks again for the great help!

Dim objSEREADERLib As New SEREADERLib.SEFileReader

Dim objAttClass As SEREADERLib.AttachmentClass

Dim objAttmnts As SEREADERLib.Attachments

If File.Exists("C:\Temp\73014012.asm") Then Kill("C:\Temp\73014012.asm")

File.Copy("ServerPath\73014012.asm", "C:\Temp\73014012.asm")

objSEREADERLib.Open("C:\Temp\73014012.asm") 

objAttmnts = objSEREADERLib.Attachments()

Dim iAttCount As Integer = objAttmnts.Count

Dim i As Integer

For i = 1 To iAttCount

    objAttClass = objAttmnts.Item(i)

    msgbox(objAttClass.Filename())

Next

Dim objDraftReader As New DRAFTDATAAPILib.DraftInfo

objDraftReader.Open("ServerPath\73432005.dft")

Dim intShtCount As Integer = objDraftReader.GetSheetCount()

Dim mSheetInfo As DRAFTDATAAPILib.DraftInfoClass

Dim n As System.UInt32 = Convert.ToUInt32(objDraftReader.GetCurrentSheetIndex)

Dim rWid As Double = 0

Dim rHgt As Double = 0

For i = 1 To intShtCount

    objDraftReader.SetMetafileName("C:\Temp\73432005.emf")

    objDraftReader.GetEnhMetafile(n, rWid, rHgt)

Next

 

Posted by: Jennece Wilson
Post date: 7/12/2010 2:14:01 AM

2 REPLIES

RE: Embedded Excel Worksheets / BOM

[ Edited ]

sorry, SEReader.dll NOT SEPartReader.dll.

 

Posted by: Jennece Wilson
Post date: 7/12/2010 2:18:55 AM

RE: Embedded Excel Worksheets / BOM

[ Edited ]

 

Well, I don't know if this is the best solution.....  but it is working better than anything else I have tried...

SFrame.DoVerb(1)   'Open the embedded ole object

objExcel = Marshal.GetActiveObject("Excel.Application")   'get a reference to the excel object

objExcel.ActiveWorkbook.SaveAs(strXLTempName)  'save into a temp file

objExcel.ActiveWorkbook.Close()  'close and release

objExcel.Quit()

Marshal.ReleaseComObject(objExcel)

then i process (without opening) using sql

 

 

Posted by: Jennece Wilson
Post date: 7/14/2010 3:36:17 AM