Q: I’m using the following code to set the color of a sketched symbol but nothing happens. How do I set the color of a sketched symbol?
sketchedSym.Color.SetColor(255, 0, 0)
A: Properties that return transient objects return a "tear off" object that's not associated to the original object it was obtained from. For example, if you have a work plane and call the Plane property, it returns a Plane object that provides the geometric information of the plane. Or if you call the Geometry property of a cylindrical face it will return a Cylinder object which provides the geometric information for a cylinder. These objects serve as a way to conveniently pass a set of related information. A Color object is also a transient that provides a convenient way to pass color information in the API.
When Color property of the SketchedSymbol object is called the API creates a new Color object using the color information associated with the symbol and returns it. The Color object returned is not associated with the symbol. When you change any of the properties of the Color object, you are changing the color object but since it's not associated with the symbol, it doesn’t affect the sketched symbol and you don't see anything happen. The way to set the color of the symbol is to use a Color object to set the Color property. A common way is to create a new Color object to pass in, as shown below.
Dim transObjs As TransientObjects
Set transObjs = ThisApplication.TransientObjects
sketchedSym.Color = transObjs.CreateColor(255, 0, 0)