I just wrote a quick and dirty macro to import some dimensions that you set in a .txt file (basically because the import equations option in Solidworks is simply SO BAD!). Now I am trying to change the delimiter to the one that is used on this machine - but nothing seems to work:
Code: Select all
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim ModelDocExtension As SldWorks.ModelDocExtension
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set ModelDocExtension = swModel.Extension
Dim docUserUnit As SldWorks.UserUnit
Set docUserUnit = swModel.GetUserUnit(swLengthUnit)
Debug.Print "Decimal separator character: " & docUserUnit.SeparatorCharacter
End Sub
This always returns
Decimal separator character: .
!
But the global decimal separator is actually a
comma (I'm back in Germany here).
How do I access the global one?
by berg_lauritz » Wed Jan 03, 2024 8:27 am
gupta9665 wrote: ↑Wed Jan 03, 2024 7:02 am
Have you looked at
swUserPreferenceToggle_e.swUseSystemSeparatorForDims method?
I did (
here), but that's just the toggle & if it is activated.
But I did find the answer now after pursuing this further, I just needed a nudge from you
@gupta9665, thank you!
This prints the character for dimensions:
Code: Select all
Dim stringstatus As String
stringstatus = swApp.GetUserPreferenceStringValue(swSeparatorCharacterForDims)
Debug.Print stringstatus
It's hidden here:
https://help.solidworks.com/2021/englis ... lue_e.html
Go to full post