Monday, April 16, 2012

Revit API Issues


Revit API Error Message:
One of the major issues I encounter when running the API code on my project file was the error message shown in Figure 33. This error message was due to the fact that the API code could not gather any instance parameters to change. In my mass family, I had type parameters for the materials of the curtain panels and this did not allow the API code to change each individual curtain panel due to the definition of a type parameter. So all I needed to do was change all of the material type parameters to instance parameters and the error was fixed.

Figure 33: C# Error message
Revit API Double Random Colors:
The second major issue I had with my API code was to make the code generate two significantly different colors for the flat face panels and the corner void panels in the full model. In Figure 29, the two panels look somewhat similar but are actually different based on the RGB integers. I thought at first that it was just a coincidence and the color just happened to turn out that way, but running it a second time slashed that theory. The pattern just kept on repeating itself. It was odd because with my small test, I knew that the two loops within the API code were engaging the right sets of panels and the two randomly generated colors were different for the two panels, so the issue must lie within the random number assignment for large scale projects. So I adjusted the limits of the random function to only choose RGB between 0 and 130 for the flat faces and 130 to 255 for the corner faces. This does limit the amount of color I would be able to generate however it gives me the necessary function to reach my design intent. 

No comments:

Post a Comment