Since you are only looking to control the visibility of attributes, rather than using the generic visibility property (i.e. DXF Group 60) you could instead use the invisible property of an attribute reference, which could be reverted manually using ATTSYNC if necessary.
To offer an example, attached is an old program following this approach (please excuse my old & ugly code formatting).
Lee