Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Output BOM info to E.R.P. database???

Status
Not open for further replies.

bsa11

Mechanical
Nov 20, 2006
13
0
0
US
we have an Intuitive E.R.P. database which operates with .net and/or ms access. wondering if anyone has something similar and has tried to output sxw bom info to import into E.R.P. database. this would help reduce the manual entry in database. any help is appreciated!!!
 
Replies continue below

Recommended for you

Intuitive ERP offers an interface and it's probably one of the better ones I've ever seen. Take a look at the videos at the link below for more detail. I was looking to implement Intuitive at a previous company and this bi-directional link of Master Data, BOM plus BOM deiscrepancy analysys and Shop Floor Routing capability was very impressive.


I am unfortunately working in an SAP environment without any integration but working to change that.

Brian
 
Hi, Bsa11:

I never use Intuitive E.R.P. database. But if it is .net based, anyone with experience in API should be able to send BOM from SW to your database.

Good Luck!

Alex
 
brian & alex - thanks for the replies!!!

brian - what swx or intuitive product do you need to get the intuitive link to work???
 
While I have not tried to connect directly with an ERP, I have written code that extracts the SolidWorks BOM. So as rgrayclamps stated, someone with API experience should be able to write code to do what you want.

SA
 
bsa11,

You'll have to call your Intuitive rep to be sure but I'm pretty sure it will work with SW2005 and above. The PDF from the site linked in my previous post is from November 05, I'm thinkig intuitive 7.0 was implemented around then.

Brian
 
thanks for the latest replies!!!

brian - your previous post with links was very helpful.
our erp expert will look into the interface.

thanks again!!!
 
attn: solidair

thanks for your reply re: swx bom output to erp.
any chance of seeing your api code???
i have no experience with api.
thanks!!!
 
This is part of a macro I wrote to extract data from SW BOM and export it in Excel. The macro was written in excel VBA and run from there. I deleted code that was not relevant for this subject. I didn't spend time to clean what is left. Take from it the idea on how to find the BOM, attach to it and how to collect the data from there. The macro also shows how to open the model used to create the drawing and read custom properties from there.

Code:
Option Explicit
Option Base 1

Dim swApp As SldWorks.SldWorks
Dim swApp1 As Object
Dim swModel As SldWorks.ModelDoc2
Dim swPart As SldWorks.DrawingDoc
Dim swView As SldWorks.View
Dim swTable As SldWorks.TableAnnotation
Const swDocDRAWING = 3
Const swTableType = 2
Const swOpenDocOptions_Silent = &H1
Public NoOfAss As Long
 
Public Type BOM_Data
    Item As String
    PartNumber As String
    Qty As String
    Description As String
    Material As String
    Supplier As String
End Type
Public LineItem() As BOM_Data
'.........................................
'.........................................
'.........................................
Sub ImportBOM()
'
'

Dim swError As Long, iPos As Long, bClose As Boolean, returnOK As Boolean
Dim nextdoc As Object, stmp As String, Model As Object
Dim sModelName As String, sPartName As String
Dim strTitle As String, strPartNumber As String
Dim i As Long, nNumRow As Long
Dim docTitle As String
'.........................................
'.........................................
'.........................................
'switch to solid works
    Set swApp = GetObject(, "SldWorks.Application")
    swApp.Visible = True
    If Err.Number <> 0 Then
        MsgBox "Can not Find SldWorks.Application" & vbCrLf & _
               "ErrNo: " & Err.Number & "  ErrMsg: " & Err.Description _
               , vbOKOnly, "Error in ExportBOM()"
        Err.Clear
        GoTo CleanUp
    End If
    
'get the drawing

    Set swModel = swApp.ActiveDoc
        
    If swModel Is Nothing Then
        Call MsgBox("Unable to open document!", vbExclamation, "Import BOM")  ' Display error message
        GoTo CleanUp           ' If no model currently loaded, then exit
    Else
        Set swPart = swModel
        docTitle = swPart.GetTitle
    End If


'Get Drawing Template (first view)
    Set swView = swPart.GetFirstView
    
    Do While Not swView Is Nothing
        Set swTable = swView.GetFirstTableAnnotation
        Do While Not swTable Is Nothing
            If swTable.Type = swTableType Then
'Process Table if BOM
                nNumRow = swTable.RowCount
                ReDim LineItem(nNumRow - 1)
                'Get table content
                For i = 1 To nNumRow - 1
                    LineItem(i).Item = swTable.Text(i, 0)
                    LineItem(i).PartNumber = swTable.Text(i, 5)
                    LineItem(i).Qty = swTable.Text(i, 1)
                    LineItem(i).Description = swTable.Text(i, 4)
                    LineItem(i).Material = swTable.Text(i, 2)
                    LineItem(i).Supplier = swTable.Text(i, 3)
                Next i
            End If
            Set swTable = swTable.GetNext
        Loop
        Set swView = swView.GetNextView
    Loop
    
    
 
 'Doc is drawing ->activate model and read "Description" from there
        Set swView = swPart.GetFirstView    'dwg template
        Set swView = swView.GetNextView     'first dwg view
'get referenced model
        sModelName = swView.GetReferencedModelName()
'switch to the model if it is already open
        sPartName = sModelName
        iPos = InStr(1, sPartName, "\")
        Do While iPos > 0
            sPartName = Right(sPartName, Len(sPartName) - iPos)
            iPos = InStr(1, sPartName, "\")
        Loop
       
'        On Error Resume Next
        Set nextdoc = swApp.GetFirstDocument
        stmp = nextdoc.GetTitle
        bClose = True 'assume file is not open
        Do While stmp <> ""
            If InStr(1, stmp, sPartName) > 0 Then
                If nextdoc.Visible = True Then
                    bClose = False 'document is already open
                Else
                    bClose = True 'document is not open yet
                End If
                Exit Do
            End If
            Set nextdoc = nextdoc.GetNext
            stmp = nextdoc.GetTitle
            If Err.Number <> 0 Then Exit Do
        Loop
        
        Set Model = swApp.ActivateDoc2(sModelName, True, swError)
        ' get Description from the model
        strTitle = Model.CustomInfo("Description")
        ' get Part Number from Model Name
        strPartNumber = Left(stmp, Len(stmp) - 7)
'reactivate drawing
'close the model
        Model.Save2 True
        If bClose = True Then 'only close if we had to open it
            swApp.CloseDoc sModelName
        End If
        
        Set swPart = swApp.ActivateDoc2(docTitle, True, swError)

'return to Excel
'.........................................
'.........................................
'.........................................
CleanUp:
    Unload frmNoOfAss
    Set swApp = Nothing
    Set swPart = Nothing
    Set swView = Nothing
    Set swTable = Nothing
    Set Model = Nothing
    Set nextdoc = Nothing
End Sub

I am not a VB programmer and may not be the most elegant code but it works for me. I am using SW2006 SP5.0

I hope this helps.
 
dogarila

thank you very much for the example.
we will try to create our own using your sample.
i'll let you know how it works.
thanks again!!!
 
Status
Not open for further replies.
Back
Top