Replaced "VariableToPreview" with "AstIdentifierBase" and simpler logic
Merge pull request #1598 from Benglin/MAGN-3236

Fix a showstopper as CBN fails to show previews and geometries