Anyway, here is a useful answer to a little question that arises from time to time:
Question: I'm creating a new 3D view of a family instance like this:
Dim v As View3D = doc.Create.NewView3D( _ famInst.FacingOrientation) v.SectionBox = famInst.BoundingBox(v)
Now I would like to set its visual style to 'Shaded' or 'Shaded with Edges'.
Is there any way to achieve this using the API?
Answer: The view style can be changed by modifying the value of the 'Visual Style' parameter, which corresponds to the built-in parameter MODEL_GRAPHICS_STYLE. Each option in the 'Visual Style' property drop-down list in the property dialog corresponds to an integer value from 0 to 6:
- Hidden line
- Shaded with Edges
- Consistent Colors
In order to change the visual style to 'Shaded with edges', please set the parameter value to 4, for instance like this:
view.get_Parameter( BuiltInParameter.MODEL_GRAPHICS_STYLE ) .set( 4 );
These numbers may have changed since they were first established. You can determine the correct numbers to use yourself by simply cycling through all the styles manually and checking the current parameter value as an integer each time, e.g. using the RevitLookup tool.