Tuesday, February 07, 2012
Embedded Excel Worksheets / BOM
Last Post 14 Jul 2010 08:36 AM by Jennece Wilson. 2 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Jennece WilsonUser is Offline
New Member
New Member
Posts:5

--
12 Jul 2010 07:14 AM  

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

Jennece WilsonUser is Offline
New Member
New Member
Posts:5

--
12 Jul 2010 07:18 AM  
sorry, SEReader.dll NOT SEPartReader.dll.
Jennece WilsonUser is Offline
New Member
New Member
Posts:5

--
14 Jul 2010 08:36 AM  

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

 

You are not authorized to post a reply.

Active Forums 4.2
Copyright © 2011 JasonNewell.NET