Showing results for 
Search instead for 
Did you mean: 

Excel Download from SE V17

Valued Contributor
Valued Contributor

I am new to .NET and Solid Edge. I want to create a program that allows for the user to pick a SE file and then generates an exploded Bill of Materials with custom Metadata in Excel. I found an example, but when I pick the file I get and error this code returns NULL fo SEPath.


SEPAth = ObjSEApp.GetOpenFileName(SolidEdgeFramework.LinksUpdateOption.igNoLinksUpdate, _

tmpstring, SolidEdgeFramework.DocumentAccess.igReadWrite, _

SolidEdgeFramework.NotifyOption.igNoNotify, obj, "Solid Edge Assembly Files (*.asm),*.asm")


Does anyone know why it is not working. The example came from the code at user group program is SampleInsighttoERP





Posted by: Kathleen Conley
Post date: 11/22/2005 2:17:54 AM


RE: Excel Download from SE V17

Valued Contributor
Valued Contributor



I would start by downloading the 2005 Solid Edge Summit .NET examples. I'm pretty sure Jason has the download link on this site to it somewhere. The first thing you should learn how to do is just load solid edge through programming. The easiest way is to use Jason's MarshalEx.vb file. I use that along with this function I wrote to load solid edge in all my programs:



' *** - LOADEDGE() - Initiates Solid Edge

Public Function LoadEdge(ByVal display As Boolean)



objApp = Marshal.GetActiveObject("SolidEdge.Application")


objApp = MarshalEx.CreateObject("SolidEdge.Application")

Catch ex As Exception

MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

End Try


If display = True Then

objApp.Visible = True : objApp.Interactive = True : objApp.DisplayAlerts = True

Else : objApp.Visible = False : objApp.Interactive = False : objApp.DisplayAlerts = False

End If


End Function



Alternately you can use this code as well:


Dim solidEdgeType As Type

Dim objApp As SolidEdgeFramework.Application


solidEdgeType = Type.GetTypeFromProgID("SolidEdge.Application")



objApp = Activator.CreateInstance(solidEdgeType)

objApp.Visible = True

Catch ex As Exception

MessageBox.Show("Solid Edge failed to start.")

End Try




Secondly I should warn you about programming with excel, it will cause you much grief if you are trying to load a sheet that is linked to a solid edge model. No matter what you cannot completely eliminate excel from memory while your program is running should you need to. As a result linked models will hickup when opened with the program. If you want to know how to manipulate cell data in excel I can throw together an example for you. I actually decided to just make a new solid edge draft file and make it look like excel, was much easier especially for BOM updating. It's very easy for updating property data as well if you keep it within solid edge.


Posted by: John Slipec
Post date: 11/22/2005 7:50:08 AM