Problem Importing Solidworks Files

Problem Importing Solidworks Files

Anonymous
Not applicable
2,114 Views
7 Replies
Message 1 of 8

Problem Importing Solidworks Files

Anonymous
Not applicable

Hi

 

I need to import solidworks files into inventor. With the help of task scheduler i can import solidworks files into inventor. But not able to import solidworks properties into inventor files.Is there any macro available to import all the solidworks properties into inventor files??

 

please provide a proper solution.

 

 

0 Likes
2,115 Views
7 Replies
Replies (7)
Message 2 of 8

YuhanZhang
Autodesk
Autodesk

Currently we don't have API exposed for specify which properties to import from Solidworks to Inventor, but as default the Solidworks file properties that mapped in the PropertyMap_SW.xml(you can find it in C:\Users\Public\Documents\Autodesk\Inventor 2018\Design Data\Import Properties\) will be imported, so I think you can manually edit the XML or just edit it using below steps:

 

1. Try to open a Solidworks file.

2. In the Import dialog, click the Property Mapping to launch the Property Mapping dialog, in the dialog you can add more Solidworks properties to map to Inventor properties.

3. Save the change and use the XML file to do your tasks.

 

At present the mapping only works for importing the Solidworks properties to Inventor standard properties, no custom properties are supported.

 

Hope this helps.

 



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 3 of 8

Anonymous
Not applicable

I am trying to open one solidworks model in inventor. Actual model is made using surfaces. When i am trying to open it inventor it appears as transparent surfaces. Please Refer the Images attached. I want the model in inventor same as solidworks. Please provide a solution.

0 Likes
Message 4 of 8

lohithna
Enthusiast
Enthusiast

dear sir  in prvious discussion you guys shared macro for copy properties to inventor ,, I can extract only summary and custom only ....configration specfic is not able to extract .. PLEASE LOOK AT  below image refrence 

 

 

 

 

BELOW MACRO PRVIOUS SHARED 

 

 

 

1. Macro to switch off translucentof part.

Sub TurnOffTranslucent()
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument

Dim oWS As WorkSurface
For Each oWS In oDoc.ComponentDefinition.WorkSurfaces
oWS.Translucent = False
Next
End Sub


2. Macro to switch off translucent of all the part files into the folder.

Sub TurnOffTranslucentForDocuments()
Dim oFSO As Object
Set oFSO = ThisApplication.FileManager.FileSystemObject

Dim oFolder As Object
Set oFolder = oFSO.getfolder("c:\temp")

' get all the part documents and turn off the work surfaces's translucent
Dim oFile As Object, oDoc As PartDocument

On Error Resume Next
For Each oFile In oFolder.Files
If Right(LCase(oFile.Name), 3) = "ipt" Then
Set oDoc = ThisApplication.Documents.Open(oFile.Path, True)
If Err Then
Debug.Print "Failed to open: " & oFile.Path
Err.Clear
Else
' Turn off the translucent for all work surfaces.
Dim oWS As WorkSurface
For Each oWS In oDoc.ComponentDefinition.WorkSurfaces
oWS.Translucent = False
Next

' save changes and close the document
If oDoc.Dirty Then
oDoc.Close False
End If
End If
End If
Next
End Sub


3. macro to open all solidworks files at once and saving it into inventor:

Sub TurnOffTranslucentForDocuments()
ThisApplication.Documents.CloseAll False

Dim oFSO As Object
Set oFSO = ThisApplication.FileManager.FileSystemObject

Dim oFolder As Object
Set oFolder = oFSO.getfolder("C:\TEMP")

' import Solidworks files into Inventor documents, and turn off the work surfaces's translucent
Dim oFile As Object, oDoc As Document

On Error Resume Next
For Each oFile In oFolder.Files
If Right(LCase(oFile.Name), 6) = "sldprt" Then
Call ThisApplication.Documents.Open(oFile.Path, True)
Set oDoc = ThisApplication.ActiveDocument

If Err Then
Debug.Print "Failed to open: " & oFile.Path
Err.Clear
Else
If oDoc.DocumentType = kPartDocumentObject Then
' Turn off the translucent for all work surfaces.
Dim oWS As WorkSurface
For Each oWS In oDoc.ComponentDefinition.WorkSurfaces
oWS.Translucent = False
Next
End If

' save changes and close the documents
If oDoc.Dirty Then
Call oDoc.Save2(True)
Debug.Print "Saved: " & oDoc.FullFileName
End If

ThisApplication.Documents.CloseAll False
End If
End If
Next
End Sub

 

 

0 Likes
Message 5 of 8

lohithna
Enthusiast
Enthusiast

dear sir  in prvious discussion you guys shared macro for copy properties to inventor ,, I can extract only summary and custom only ....configration specfic is not able to extract .. PLEASE LOOK AT  below image refrence 

 

0 Likes
Message 6 of 8

YuhanZhang
Autodesk
Autodesk

Hi Lohithna,

 

The macros I shared to the customer are not used to import the properties but just do batch importing and change the color(translucent of surfaces). Currently we don't have Inventor API to specify which properties to import for Solidworks files, there is a .XML file(C:\Users\Public\Documents\Autodesk\Inventor 2018\Design Data\Import Properties\PropertyMap_SW.xml) used to map the Solidworks and Inventor properties that I think you can try to edit it to import some Solidworks properties or use below dialog to map the properties, but it only works for standard properties, so if you want to import the Configuration specific properties to Inventor files you can log a wishlist to IdeaStation. Hope this explains.

 

MapProperties.png



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 7 of 8

lohithna
Enthusiast
Enthusiast

i have found the macro to acces the properties from excel to inventor , but issue is i have number of files in other excel it need to write in inventor ..........

current macro as only able to write active document,please alter the macro for acces the document 

 

this macro help to write to solid works part to be write i need to write in invemtor 

 

 

 

Private Sub CommandButton2_Click ()

'how many attributes are read

Attrkpl = Sheet1.Range ("D3"). Value

Attrkplm = "-" & Attrkpl

 

'' gripped 'to the SW

Set SwApp = CreateObject ("SldWorks.Application")

 

'Activate the sheeting for security

Worksheets ( "Assys"). Activate

 

'read a work folder

Path = Sheet1.Range ("D4") Value & "\"

 

'to the start point

Sheet1.Range ( "A8"). Activate

 

'until the filename is empty, ie the templates are over ...

Do While ActiveCell.Value <> ""

 

'open the file

File = ActiveCell.Value

Set Model = swApp.OpenDoc (Path & File, swDocAssembly)

 

ActiveCell.Offset (0, 2) .Activate

 

'delete custom information and type new

Set AttrNimiSolu = Sheet1.Range ("C6")

 

For i = 1 To Attrkpl

 

retval = Model.DeleteCustomInfo2 ("", AttrNimiSolu)

retval = Model.AddCustomInfo3 ("", AttrNimiSolu, swCustomInfoText, ActiveCell.Value)

ActiveCell.Offset (0, 1) .Activate

 

Set AttrNimiSolu = AttrNimiSolu.Offset (0, 1)

Next i

 

'Configuration information the same thing, first transfer

ActiveCell.Offset (1, Attrkplm - 1) .Activate

Config = Model.GetConfigurationNames

 

For j = 0 To UBound (Config)

Set AttrNimiSolu = Sheet1.Range ("C6")

Configuration = ActiveCell.Value

For k = 1 To Attrkpl

 

ActiveCell.Offset (0, 1) .Activate

 

If ActiveCell.Value <> "" Then

retval = Model.DeleteCustomInfo2 (Configuration, AttrNimiSolu)

retval = Model.AddCustomInfo3 (Configuration, AttrNimiSolu, swCustomInfoText, ActiveCell.Value)

else

retval = Model.DeleteCustomInfo2 (Configuration, AttrNimiSolu)

End If

 

Set AttrNimiSolu = AttrNimiSolu.Offset (0, 1)

Next k

ActiveCell.Offset (1, Attrkplm) .Activate

Next j

 

'go next to the title

ActiveCell.Offset (1, -1) .Activate

 

    

'save and close the already processed template

Model.Save

Title = Model.GetTitle

swApp.CloseDoc Title

 

 

loop

 

MsgBox "Done!"

 

End Sub

 

 

0 Likes
Message 8 of 8

lohithna
Enthusiast
Enthusiast

i have found the macro to acces the properties from excel to inventor , but issue is i have number of files in other excel it need to write in inventor ..........

current macro as only able to write active document,please alter the macro for acces the document 

 

this macro help to write to solid works part to be write i need to write in invemtor 

 

 

 

Private Sub CommandButton2_Click ()

'how many attributes are read

Attrkpl = Sheet1.Range ("D3"). Value

Attrkplm = "-" & Attrkpl

 

'' gripped 'to the SW

Set SwApp = CreateObject ("SldWorks.Application")

 

'Activate the sheeting for security

Worksheets ( "Assys"). Activate

 

'read a work folder

Path = Sheet1.Range ("D4") Value & "\"

 

'to the start point

Sheet1.Range ( "A8"). Activate

 

'until the filename is empty, ie the templates are over ...

Do While ActiveCell.Value <> ""

 

'open the file

File = ActiveCell.Value

Set Model = swApp.OpenDoc (Path & File, swDocAssembly)

 

ActiveCell.Offset (0, 2) .Activate

 

'delete custom information and type new

Set AttrNimiSolu = Sheet1.Range ("C6")

 

For i = 1 To Attrkpl

 

retval = Model.DeleteCustomInfo2 ("", AttrNimiSolu)

retval = Model.AddCustomInfo3 ("", AttrNimiSolu, swCustomInfoText, ActiveCell.Value)

ActiveCell.Offset (0, 1) .Activate

 

Set AttrNimiSolu = AttrNimiSolu.Offset (0, 1)

Next i

 

'Configuration information the same thing, first transfer

ActiveCell.Offset (1, Attrkplm - 1) .Activate

Config = Model.GetConfigurationNames

 

For j = 0 To UBound (Config)

Set AttrNimiSolu = Sheet1.Range ("C6")

Configuration = ActiveCell.Value

For k = 1 To Attrkpl

 

ActiveCell.Offset (0, 1) .Activate

 

If ActiveCell.Value <> "" Then

retval = Model.DeleteCustomInfo2 (Configuration, AttrNimiSolu)

retval = Model.AddCustomInfo3 (Configuration, AttrNimiSolu, swCustomInfoText, ActiveCell.Value)

else

retval = Model.DeleteCustomInfo2 (Configuration, AttrNimiSolu)

End If

 

Set AttrNimiSolu = AttrNimiSolu.Offset (0, 1)

Next k

ActiveCell.Offset (1, Attrkplm) .Activate

Next j

 

'go next to the title

ActiveCell.Offset (1, -1) .Activate

 

    

'save and close the already processed template

Model.Save

Title = Model.GetTitle

swApp.CloseDoc Title

 

 

loop

 

MsgBox "Done!"

 

End Sub

 

 

0 Likes