Passing 'Angle' value to instance 'Angle parameter type

Passing 'Angle' value to instance 'Angle parameter type

Anonymous
Not applicable
3,047 Views
2 Replies
Message 1 of 3

Passing 'Angle' value to instance 'Angle parameter type

Anonymous
Not applicable
Hi,

I am getting some wierd angle results when I pass an angular value (e.g. 45 degrees) stored in  'Double' variable, and passing it to re-set the 'AngleRot' instance parameter in the family.

As an example, if the the value obtained is 45 degrees then when I pass it to set the 'AngleRot' instance parameter, the family shows 1543.34567...  Some strange value!!

What is teh method for converting the Double value to an Angular value correct in C# to assign it to a Revit instance parameter of 'Angle' type...

Thanks for your help

###### CODE BEGIN  ######
double AngleDbl = 35.5;

param1 = familyinstance.get_Parameter("AngleRot");
param1.Set(AngleDbl);

###### CODE END ######

Zak
0 Likes
Accepted solutions (1)
3,048 Views
2 Replies
Replies (2)
Message 2 of 3

ollikat
Collaborator
Collaborator

I think you should give angles as radians for that parameter.

Message 3 of 3

Anonymous
Not applicable
Accepted solution

Hi Olikat,

 

Thanks for your great help. You have saved my day. I have converted the angle value from Degrees to Radians, and then passed the value to the instance parameter. That worked. Here is the line of code modified below.

 

double AngleDbl = 35.5 * Math.PI / 180;

 

Thanks - Zak