Page 1 of 1

Undocumented and missing system options

Posted: Thu Dec 21, 2023 9:02 am
by mp3-250
I am approaching our company update and lik every year I am trying to clean up our settings. Once and for all.
I use a modified sldreg to overwrite in the workstation registry. More than one to be honest.

I have run in some undocumented keys like the ability to block the editing of model dimension from drawings.
https://www.goengineer.com/blog/solidwo ... odel-items

But I have found some deprecated key that our settings are dragging along since years and years ago like
‘No Preview during open (faster)’ option in ‘System Options’ > ‘Performance’

which is officially deprecated as it was introduced during the single core CPU era and it would slow down performance with modern machines.

I had also some bad experience with the system options intrface, like looking for an entry and it returns no results because the entry is "in the page,but hidden" in the current SW mode. I think is what happens to DXF export settings if you are not opening system options from the drawing enviroinment.

Question 1: where I can find ALL the settings supported by solidworks?
Or at least force them to show therir current setting inside the UI...
Cad admin dashboard seems to know what setting is not supported while monitoring the workstations registry, but it does not say WHAT setting is not recognized only their count, So I know I have at least a couple of faulty settings, but not where they are...and there are hundreds on registry lines to check.

The only thing close seems to be in the API section, but a bit unpractical
https://help.solidworks.com/2022/engli ... Redirect=1

Question 2: or better a general advice on setting up SW.
"SOLIDWORKS® has an option to reset the system options to default settings. Is it possible to customize this option to use custom settings other than factory default settings?
https://kb.dsxclient.3ds.com/mashup-ui/ ... 000114399e"
The KB says that it is not possibile to customize your default settings when a reset is triggered, but they explain in another place (and I know because I "reverse engineered" that reset) that those settings are taken from the HKLM keys that HKCU mirrors, so I basically overwritten the main general settings and even if my users trigger the reset he ends up with MOST of the settings set to our company default and not some SW random one.
But again it does not work on all settings inside System options

I looked at admin image .sldsettings, but I think I gave up as IIRC that file would be binary format and not a more confortable registry format. (at least for me I find it quicker to install via batch file)
Also it does not handle ALL SW options like converter settings and other stuff.

I have also some reason to not trust the export settings utility as it exports a lot of garbage as well, and with syntax errors for a REG4 format...

Re: Undocumented and missing system options

Posted: Thu Dec 21, 2023 11:01 am
by Frederick_Law
Do not import/export on first start of SW. Need to close SW to save registry settings.
Restart SW then export/import.
I don't know if SW create all the values. Some program only create one if it's not default.
Extra should not be a problem because program should not look for them.

Use program to compare reg files. Or write one just for SW.
Beside adding and deleting settings, SW might move them to different key.

Build a database/spreadsheet of values: default value, reg key, SW version.

"Reset Default" usually is just delete everything and let SW recreate using internal default. Hence the delete registry to reset SW.
So no, don't think that list can be changed.

Corruption.
You can restore part of the settings.
Import one group at a time until the problem return. Reset and don't import the failed group.
I think it's the same group that get corrupted most of the time.

Re: Undocumented and missing system options

Posted: Thu Dec 21, 2023 4:18 pm
by mp3-250
@Frederick_Law on paper is correct what you say.
i did it for e drawings and pdm (which is actually partially documented) and add ins loading.
toolbars, gestures, shortcut and macro are more or less isolated (toolbars is a stream of 100+ numerical nonsense lines...)

To document sw settIngs like that it will probably take forever.
There is no way to turn system options on and off from a single place, depending you are on modelling, drafting or assembly environment some of them just do not show in the UI or are just ineffective if checked. hundreds of them, let alone related one which require to activate one to set the others. it is a hell and inside our legacy settings. last update. I triggered a crash because SW was exporting the WPF section of its own registry with an unescaped path (\ instead \\) dozen lines wrong.
importing with setting wizard corrected (or ignored) them somehow .

this is why it should be nice to have the admin tool working, but it has a lot of SPRs and
reported problems (like it" does not work as advertised" sort of reports in the kb) . I tryed it again with the jpn version of solidworks: the buttons un the wizard just disappear and there is no save button... reading the kb was SAD: it is said it does not work nd settings are not applied.

Re: Undocumented and missing system options

Posted: Thu Dec 21, 2023 5:36 pm
by Frederick_Law
Imported a 2019 setting export to excel.
Around 16000 lines with UI stuff.
Around 10000 without.

Write a program to read, catalog, compare settings.
Mapping them to UI options will be, tedious.
This will need update on every new version, if not every SP.

If SW export is bad, export from Regedit.

Re: Undocumented and missing system options

Posted: Fri Dec 22, 2023 4:30 am
by mp3-250
I am splitting the settings in 4 parts:

1. toolbars, gestures, saved views, menu customizations: those are graphically driven

2. macro folders, do not display again messeges and color settings: those are relatively easy to setup and check. also they are a bit insulted from the main blob of settings.

3. the blob under solidworks 2022/general: this is the main problem, but at last I could compare it with the default inside HKLM and see what we have set (more or less)

4. some setting outside the previous 3 to avoid annoyances like license expiration messages and other I do not remember atm

Re: Undocumented and missing system options

Posted: Fri Dec 22, 2023 12:43 pm
by Frederick_Law
Started VS project to convert registry to SQL database.
I was using MS Access and Borland Database engine before.

A quick test opening .sldreg in excel with = as delimiter and move Registry Key to another column:
RegistryDB-01.jpg

Re: Undocumented and missing system options

Posted: Sun Dec 24, 2023 3:47 am
by mp3-250
I found a function written for Powershell to export a registry key and subkeys as csv file.

It could be copy pasted in the PS console before executing the command.

Code: Select all

function Export-Registry {
    param (
        [parameter(Mandatory = $true, HelpMessage = "Enter the path to start from, for example HKLM:SOFTWARE\Microsoft\Policies")][string]$Path,
        [parameter(Mandatory = $true)][string]$Outfile
    )
    
    #Test if $Path is accessible
    if (Test-Path $path -ErrorAction stop) {
        Write-Host ("Path {0} is valid, continuing..." -f $Path) -ForegroundColor Green
    }
    else {
        Write-Warning ("Could not access path {0}, check syntax and permissions. Exiting..." -f $path)
        return
    }

    #Check file extension, if it's not .csv or .xlsx exit
    if (-not ($Outfile.EndsWith('.csv') -or $Outfile.EndsWith('.xlsx'))) {
        Write-Warning ("The specified {0} output file should use the .csv or .xlsx extension, exiting..." -f $Outfile)
        return
    }


    #Set $keys variable
    Write-Host ("Retrieving keys from {0}" -f $Path) -ForegroundColor Green
    $keys = Get-ChildItem -Path $path -Recurse -ErrorAction SilentlyContinue

    $total = foreach ($key in $keys) {
        foreach ($property in $key) {
            Write-Host ("Processing {0}" -f $property) -ForegroundColor Green
            foreach ($name in $key.Property) {
                try {   
                    [PSCustomObject]@{
                        Name     = "[$($property.Name)]"
                        Property = "$($name)"
                        Type     = $key.GetValueKind($name)
                        Value    = Get-ItemPropertyValue -Path $key.PSPath -Name $name
                    }
                }
                catch {
                    Write-Warning ("Error processing {0} in {1}" -f $property, $key.name)
                }
            }
        }
    }
    
    #Export results to either CSV of XLSX, install ImportExcel module if needed
    if ($Outfile.EndsWith('.csv')) {
        try {
            New-Item -Path $Outfile -ItemType File -Force:$true -Confirm:$false -ErrorAction Stop | Out-Null
            $total | Sort-Object Name, Property | Export-Csv -Path $Outfile -Encoding UTF8 -Delimiter ';' -NoTypeInformation
            Write-Host ("`nExported results to {0}" -f $Outfile) -ForegroundColor Green
        }
        catch {
            Write-Warning ("`nCould not export results to {0}, check path and permissions" -f $Outfile)
            return
        }
    }
    
    if ($Outfile.EndsWith('.xlsx')) {
        try {
            #Test path and remove empty file afterwards because xlsx is corrupted if not
            New-Item -Path $Outfile -ItemType File -Force:$true -Confirm:$false -ErrorAction Stop | Out-Null
            Remove-Item -Path $Outfile -Force:$true -Confirm:$false | Out-Null
            
            #Install ImportExcel module if needed
            write-host ("Checkig if ImportExcel PowerShell module is installed...") -ForegroundColor Green
            if (-not (Get-Module -ListAvailable | Where-Object Name -Match ImportExcel)) {
                Write-Warning ("`nImportExcel PowerShell Module was not found, installing...")
                Install-Module ImportExcel -Scope CurrentUser -Force:$true
                Import-Module ImportExcel
            }

            #Export results to path
            $total | Sort-Object name, Property | Export-Excel -AutoSize -BoldTopRow -FreezeTopRow -AutoFilter -Path $Outfile
            Write-Host ("`nExported results to {0}" -f $Outfile) -ForegroundColor Green
        }
        catch {
            Write-Warning ("`nCould not export results to {0}, check path and permissions" -f $Outfile)
            return
        }
    }
}
After pasting (or registering) the function above just type:

Code: Select all

export-registry -Path 'HKLM:Software\solidworks\solidworks 2022' -Outfile TEST.csv
without an output path the TEST.csv file is exported in %userprofile% root folder.

Re: Undocumented and missing system options

Posted: Sat Dec 30, 2023 12:10 am
by ryan-feeley
To add to what @Frederick_Law said, in addition to restarting the machine after a fresh install of Solidworks, to archive the canonical settings you should
  1. Create dummy Part, Assembly, and Drawing files (default templates is fine). This populates additional entries in the registry.
  2. Open the system options editor and click the "Reset All" button. For some reason, the default install doesn't actually populate all the registry values with their "reset" values. Strange, but Solidworks...
I created a script some time back that dumps most of the solidworks related registry settings to six .reg files that are placed in the current directory. Having these, I use beyondcompare to diff against them. It natively parses .reg files. I haven't tested it on 2023 or 2024, so I can't promise it will work for you.

You run the script in powershell as admin, while providing the Solidworks year you want the export for.

So enter something like this in powershell

Code: Select all

./swx-registry-export 2020
I've attached it in a zip file if you want to view or run it. It works by copying the registry entries for solidworks into dummy keys, doing some registry operations on the dummy versions to export relevant stuff, and then deleting the dummy keys. In short, it messes with your registry. So back it up, trust that I'm not installing viruses, skim the code, etc.

If you haven't already, you'll need to give powershell permission to run local scripts. Run it as admin and do

Code: Select all

Set-ExecutionPolicy -Scope "CurrentUser" -ExecutionPolicy "RemoteSigned"
Even further in the past I created a script that attempted to eliminate UI-related stuff from the Solidworks .sldreg files, to make them easier to diff. I can share that if anyone wants it, but it is very unpolished. I used it to solve the problem I was having at the time, and didn't take it any further. That was a real headache. On one of our machines, almost every single solidworks file opened dirty, which was hell on in-context references. The issue was the "History Length" setting in the feature tree. That machine had it set to 5. So if you opened a file that had more than 5 entries in the feature history (which by default is pruned to 10), solidworks would shorten the history upon opening the file, thus making it dirty.

Re: Undocumented and missing system options

Posted: Sat Dec 30, 2023 10:15 pm
by mp3-250
ryan-feeley wrote: Sat Dec 30, 2023 12:10 am To add to what @Frederick_Law said, in addition to restarting the machine after a fresh install of Solidworks, to archive the canonical settings you should
  1. Create dummy Part, Assembly, and Drawing files (default templates is fine). This populates additional entries in the registry.
  2. Open the system options editor and click the "Reset All" button. For some reason, the default install doesn't actually populate all the registry values with their "reset" values. Strange, but Solidworks...
I created a script some time back that dumps most of the solidworks related registry settings to six .reg files that are placed in the current directory. Having these, I use beyondcompare to diff against them. It natively parses .reg files. I haven't tested it on 2023 or 2024, so I can't promise it will work for you.

You run the script in powershell as admin, while providing the Solidworks year you want the export for.

So enter something like this in powershell

Code: Select all

./swx-registry-export 2020
I've attached it in a zip file if you want to view or run it. It works by copying the registry entries for solidworks into dummy keys, doing some registry operations on the dummy versions to export relevant stuff, and then deleting the dummy keys. In short, it messes with your registry. So back it up, trust that I'm not installing viruses, skim the code, etc.

If you haven't already, you'll need to give powershell permission to run local scripts. Run it as admin and do

Code: Select all

Set-ExecutionPolicy -Scope "CurrentUser" -ExecutionPolicy "RemoteSigned"
Even further in the past I created a script that attempted to eliminate UI-related stuff from the Solidworks .sldreg files, to make them easier to diff. I can share that if anyone wants it, but it is very unpolished. I used it to solve the problem I was having at the time, and didn't take it any further. That was a real headache. On one of our machines, almost every single solidworks file opened dirty, which was hell on in-context references. The issue was the "History Length" setting in the feature tree. That machine had it set to 5. So if you opened a file that had more than 5 entries in the feature history (which by default is pruned to 10), solidworks would shorten the history upon opening the file, thus making it dirty.
@ryan-feeley thank you for sharing the script, I will take a look at it.

One of the many things SW settings annoys me is the lack of order with many unrealted settings thrown together in the same place in the registry. But as you said, there are a lot of settings that are disabled by default and until you make a certain action the corresponding registry key is not created. Like recovery or backup.

this is VERY annoying.

And there is not a single place to manage those settings and the admin image tool that is supposed to do it cover only a part of those settings. If it worked... the japanese version at least just refuse to generate a setting file at all.

UI-related settings are easier to spot, and they could be exported separetely, but "for reasons" the devs put some UI setting like color schemes inside the general settings, or toolbars settings separated from the user interface part...
and there are hundreds like that.

Also depending on the current environment be modeling assembly or drafting the system option content change. Like DXF export is not shown in modelling, but in drafting you can see it. This is apparently logic, but makes the administration a hell.
There is not a single place to check ALL settings together.

Re: Undocumented and missing system options

Posted: Fri Jan 05, 2024 2:26 pm
by Frederick_Law
https://betanews.com/2015/11/18/how-to- ... y-changes/

Download here:
https://learn.microsoft.com/en-us/sysin ... ds/procmon

#4 Process Monitor could show in realtime how SW settings change Registry.