Is it possible to open 3dmax file in SolidWorks?
6 Answers
----------------------------------------------------------------------------
' Preconditions:
' 1. Read the SolidWorks Document Manager API Getting Started
' topic and ensure that the required DLLs are registered.
' 2. Copy and paste this module into a VB.NET console application
' in Microsoft Visual Studio.
' 3. Ensure that the specified document exists
' (or point to another document).
' 4. Add the Solidworks.Interop.swdocumentmgr.dll reference
' to the project:
' a. Right-click the solution in Solution Explorer.
' b. Select Add Reference.
' c. Click the Browse tab.
' d. Load:
' <SolidWorks_install_dir>\api\redist\Solidworks.Interop.swdocumentmgr.dll
' 5. Add the following references to the project: System.Drawing.dll,
' stdole.dll, Microsoft.VisualBasic.Compatibility.VB6.dll.
' 6. Substitute <your_license_code> with your SolidWorks
' Document Manager license key.
' 7. Compile and run this program in Debug mode.
'
' Postconditions: Inspect the Output Window and the code to see
' how the API is used.
'---------------------------------------------------------------------------
Imports SolidWorks.Interop.swdocumentmgr
Imports Microsoft.VisualBasic.Compatibility.VB6
Imports stdole
Imports System.Drawing.Image
Module Module1
Sub main()
' Substitute the path and name of your file for the following path and file name
Const sDocFileName As String = "C:\Program Files\SolidWorks Corp\SolidWorks\samples\tutorial\multibody\multi_inter.sldprt" 'Specify document
Const sExtractDir As String = "c:\temp\"
Dim swClassFact As SwDMClassFactory
Dim swDocMgr As SwDMApplication
Dim swDoc As SwDMDocument
Dim swCfgMgr As SwDMConfigurationMgr
Dim vCfgNameArr As Object
Dim vCfgName As Object
Dim swCfg As SwDMConfiguration7
Dim pPreview As IPictureDisp
Dim nDocType As Long
Dim nRetVal As Long
Dim image As Drawing.Image
' Determine type of SolidWorks file based on file extension
If InStr(LCase(sDocFileName), "sldprt") > 0 Then
nDocType = SwDmDocumentType.swDmDocumentPart
ElseIf InStr(LCase(sDocFileName), "sldasm") > 0 Then
nDocType = SwDmDocumentType.swDmDocumentAssembly
ElseIf InStr(LCase(sDocFileName), "slddrw") > 0 Then
nDocType = SwDmDocumentType.swDmDocumentDrawing
Else
' Probably not a SolidWorks file,
' so cannot open
nDocType = SwDmDocumentType.swDmDocumentUnknown
Exit Sub
End If
' Because drawing documents do not have configurations,
' only continue running the macro if the document
' is a part or assembly document
If (nDocType <> SwDmDocumentType.swDmDocumentDrawing) Then
swClassFact = CreateObject("SwDocumentMgr.SwDMClassFactory")
swDocMgr = swClassFact.GetApplication("<your_license_code>") 'Specify license key
swDoc = swDocMgr.GetDocument(sDocFileName, nDocType, False, nRetVal) : Debug.Assert(SwDmDocumentOpenError.swDmDocumentOpenErrorNone = nRetVal)
swCfgMgr = swDoc.ConfigurationManager
Debug.Print("File = " & swDoc.FullName)
Debug.Print(" Active configuration name = " & swCfgMgr.GetActiveConfigurationName)
vCfgNameArr = swCfgMgr.GetConfigurationNames
For Each vCfgName In vCfgNameArr
swCfg = swCfgMgr.GetConfigurationByName(vCfgName)
pPreview = swCfg.GetPreviewPNGBitmap(nRetVal)
image = Support.IPictureDispToImage(pPreview)
image.Save(sExtractDir & vCfgName & ".PNG")
Debug.Print(" " & vCfgName)
Debug.Print(" PNG preview stream = " & swCfg.PreviewPNGStreamName)
Debug.Print(" ")
Next
swDoc.CloseDoc()
End If
End Sub
End Module
Navneet,
The link I gave you earlier was for the exporter, but here is the link to the importer.
http://www.solidworks.com/uploads/solutionpartner/pdfs/3DS%20Import%20for%20SolidWorks.pdf
The possibilities are, you can save as the 3dmax file to the format of 3D
XML(*.3dxml)or Universal 3D(*.u3d).Then these format files can be open in
solidworks.
Me to. I search the net but I did found nothing. Solidworks file can be opened in 3d max but SW can't open.
Siva probably shared a visual basic codes for it. But how can we use it ??
Navneet,
Sycode.com has an add-ins.
http://www.caddepot.com/index.php?main_page=product_info&cPath=76&products_id=465
Hope that can help.
Raed.