Reply
Solved! Go to solution

GetMaterialList returns NotImplemented error

Hi people,

 

when i run this code in a solid edge add-in the last line of it throws a "not implemented exception"

 

        Dim ListOfMaterials As Object = Nothing
        Dim NumMaterials As Integer = 0

            seMatTable = seApplication.GetMaterialTable()
            seMatTable.SetActiveDocument(seApplication.ActiveDocument)
            seMatTable.GetMaterialList(NumMaterials, ListOfMaterials)

I am trying to get all the materials from the table into a combo box, any help will be greatly appreciated.

10 REPLIES

Re: GetMaterialList returns NotImplemented error

BertW,

 

GetMaterialList works with my VB6 test application.

I declared ListofMaterials as Variant.

 

HTH

Gerald

Re: GetMaterialList returns NotImplemented error

this is workign for me in a macro...

 

'Material Table

Dim ObjMatTbl As SolidEdgeFramework.MatTable

Dim MatListArray As Object 'material list array

Dim MatListLen As Long 'length of mat list array

Dim MatFile As Object

Dim sMat As String

Private Sub GetMatTable()

ObjMatTbl = objApp.GetMaterialTable

ObjMatTbl.GetMatLibFileName(MatFile) 'material file name

ObjMatTbl.GetMaterialList(MatListLen, MatListArray) 'matlistarray will hold all material names

Array.Sort(MatListArray)

cbMaterial.DataSource = MatListArray

End Sub

Re: GetMaterialList returns NotImplemented error

Thanks for all the help, but all to no avail. I keep getting the not implemented error, i've tried it with the Interop.SolidEdge reference and with the standard references. But it didn't make a difference.

Re: GetMaterialList returns NotImplemented error

you sure you are running your code against a part or sheetmetal not a draft or assembly?

Because Draft and Assembly do not have the Material Library

 

Re: GetMaterialList returns NotImplemented error

I can confirm that it is not working for me either. I'm on Solid Edge ST7 MP3. Here is a screenshot of the ReportMaterials demo from the GitHub Samples. I would not have released this particular sample when I wrote it if it didn't work. I'll have to try and do some testing in my virtual machines to identify what version of SE it quit working in. In the meantime, I would suggest submitting an IR with GTAC.

 

Jason Newell
Applications Architect
www.jasonnewell.net

Re: GetMaterialList returns NotImplemented error

I should have posted what i was running with, but yeah i'm using ST7 MP3. I'll submit an IR for this.

Solution
Solution
Accepted by topic author BertW
‎08-26-2015 04:32 AM

Re: GetMaterialList returns NotImplemented error

Solid Edge ST7 introduced the option to have multiple Material Libraries.To handle this new API functions have been implemented which support the name ofthe Material Library as additional parameter. The old API functions should work(error correction was delivered with ST7MP2) when only one Material Library willbe used. 

 

1. Old API: GetMaterialList   

 New API: GetMaterialListFromLibrary

 

 2. Old API: GetMatPropValue  

New API: GetMaterialPropValueFromLibrary 

 

3. Old API: SetMatPropValue  

New API: SetMaterialPropValueToLibrary      

 

4. Old API: DeleteMaterial  

New API: DeleteMaterialFromLibrary  

 

5. Old API: AddMaterial  

New API: AddMaterialToLibrary     

 

6. Old API: GetMatLibFileName   

New API: GetMaterialLibraryFileList  

 

7. Old API: WriteMaterialDataToXML  

New API: ExportMaterialDataToFile

Re: GetMaterialList returns NotImplemented error

Interesting. Thanks for sharing.

Jason Newell
Applications Architect
www.jasonnewell.net

Re: GetMaterialList returns NotImplemented error

[ Edited ]

I can confirm that under ST8 (MP update 5) the OLD material library call no longer works

 

Solid Edge Version 108.00.05.004 x64

 

matTable.GetMaterialList(plNumMaterials, objMaterials)

 

>> HRESULT: 0x80004001 (E_NOTIMPL)

 

Beware the fact that i'm unfortunately forced using SE Interop libraries from ST3

(and i cannot change it because switching to ST4 require a new .net framework)

 

So, my assumption is that some internal Guids in ST8 has been removed (or changed), thus any attempt to use GetMaterialList even from an older interop library led to a crash with a NOIMPL result.

 

Siemens developer *MUST* correct this, or legacy applications using materials will not work anymore without recompiling with newer interop libraries.

 

Using ILSpy, i have noticed where these methods seem to be still implemented:

 

'From ST3 interop library

 Namespace SolidEdge.Framework.Interop
    <DefaultMember("GetMaterialList"), Guid("E25441E6-A8EC-4907-B3C5-0454EE164E1D"), InterfaceType(2), TypeLibType(4096)>
    <ComImport()>
    Public Interface MatTable
        <DispId(0)>
        <MethodImpl(MethodImplOptions.PreserveSig Or MethodImplOptions.InternalCall)>
        Sub GetMaterialList(<Out()> ByRef plNumMaterials As Integer, <MarshalAs(UnmanagedType.Struct)> <Out()> ByRef listOfMaterials As Object)

'From ST8 interop library

 Namespace SolidEdge.Framework.Interop
    <DefaultMember("GetMaterialList"), Guid("E25441E6-A8EC-4907-B3C5-0454EE164E1D"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch), TypeLibType(TypeLibTypeFlags.FDispatchable)>
    <ComImport()>
    Public Interface MatTable
        <DispId(0)>
        <MethodImpl(MethodImplOptions.PreserveSig Or MethodImplOptions.InternalCall)>
        Sub GetMaterialList(<Out()> ByRef plNumMaterials As Integer, <MarshalAs(UnmanagedType.Struct)> <Out()> ByRef listOfMaterials As Object)

 

I see only some small discrepancies thhere, ID of MatTable class seems identical.. but in ST8 do not work. I will try with late binding as a last resort!