I am currently translating some SolidWorks files from Mandarin to English, and the code that I have will translate everything besides the names of the mates; I was hoping somebody could show me, what I will have to add to the code or if there is another code outer that does the same thing?
Dim swApp As SldWorks.SldWorks
Dim swAss As SldWorks.AssemblyDoc
Dim swFeat As SldWorks.Feature
Dim newName As String
Dim dicFeatsCount As Object
Dim dicBaseNames As Object
Sub main()
Set dicFeatsCount = CreateObject("Scripting.Dictionary")
Set dicBaseNames = CreateObject("Scripting.Dictionary")
'Add the list of predefined base names
'- - - - - - - - - - - - - - - - - - - -
dicBaseNames.Add "ProfileFeature", "Sketch"
dicBaseNames.Add "Extrusion", "Extrude"
dicBaseNames.Add "RefPlane", "Plane"
'- - - - - - - - - - - - - - - - - - - -
Set swApp = Application.SldWorks
Set swAssm = swApp.ActiveDoc
Set swFeat = swAssm.FirstFeature
While Not swFeat Is Nothing
If dicFeatsCount.exists(swFeat.GetTypeName2()) Then
dicFeatsCount.Item(swFeat.GetTypeName2()) = dicFeatsCount.Item(swFeat.GetTypeName2()) + 1
Else
dicFeatsCount.Add swFeat.GetTypeName2(), 1
End If
If dicBaseNames.exists(swFeat.GetTypeName2()) Then
newName = dicBaseNames.Item(swFeat.GetTypeName2())
Else
newName = swFeat.GetTypeName2()
End If
newName = newName & dicFeatsCount.Item(swFeat.GetTypeName2())
swFeat.Name = newName
Set swFeat = swFeat.GetNextFeature
Wend
End Sub
