The showTextureMap() function provides control over both material and map level texture showing in the viewport.
If the optional <texmap> or <material> is not specified, Show Map in Viewports is set for the argument 1 material to the <boolean> argument.
If the optional <texmap> is specified, it will be searched for in the argument 1 material. It must be a direct subtexture of the supplied argument 1 material. Its show-in-viewport state will be set on or off according to the <boolean> argument.
If the optional material is specified, it will be searched for in the argument 1 material. Its show-in-viewport state will be set on or off according to the <boolean> argument.
Mapping coordinates aren't explicitly enabled for all objects at creation time. When a script is run in the Listener, using 'showTextureMap' is indirectly turning mapping coordinates on. This happens during the scene redraw which happens after each line is executed, if needed. If a script is run from a script editor, or if you put parenthesis around a script, no scene redraw is performed until the entire script is run. Since no redraw is performed, no mapping coordinates exist on the object when the script tries to access them. Solutions: explicitly perform a scene redraw [redrawViews()] after 'showTextureMap', or explicitly turn on mapping coordinates for the object.
The following methods introduced in 3ds Max 2008 provide control over the state of the Hardware Mode Show Map In Viewports available as a flyout option to the regular Show Map In Viewports icon:
This method allows control over the state of the flyout at both material and map level.
When set to true, the flyout will be switched to Hardware mode (magenta icon).
When set to false, the flyout will be switched to Software mode (blue icon)
This method provides control over the state of the Show Map In Viewport icon at both material and map level.
When set to true, the icon will be pressed. When set to false, it will be depressed.
The flyout must be in hardware mode when using this method - see the enable Hardware Material method described above. If it is not, the icon will be pressed but no maps will be displayed in the viewport.