Author Topic: Question about Rotation  (Read 1685 times)

0 Members and 1 Guest are viewing this topic.

kees987

  • Guest
Question about Rotation
« on: February 01, 2015, 02:37:41 PM »
When i attach an xref through the code i also try to give it a rotation:
Code - C#: [Select]
  1. double rotation = 90;
  2. BlockReference blockRef = new BlockReference(insertPoint, objtId);
  3. blockRef.Rotation = rotation;
  4.  
But it is not really clear to me what the units are that the rotation is using.
Looking in my drawing where the units are set to "Decimal Degree" the double value of 90 ends up in a rotation of 333.
I cant really find the logic in this. Am i using the rotation wrong, or can i somehow set the unit type before applying the value to the block ?
« Last Edit: February 01, 2015, 02:41:40 PM by kees987 »

huiz

  • Swamp Rat
  • Posts: 917
  • Certified Prof C3D
Re: Question about Rotation
« Reply #1 on: February 01, 2015, 03:00:11 PM »
Programmatically AutoCAD always expect radians.

The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

BillZndl

  • Guest
Re: Question about Rotation
« Reply #2 on: February 02, 2015, 10:35:40 AM »
Code - C#: [Select]
  1. public static double Deg2Rad(double degrees)
  2.         {
  3.             return Math.PI * degrees / 180.0;
  4.         }
  5.  
  6.         public static double Rad2Deg(double angle)
  7.         {
  8.             return angle * (180.0 / Math.PI);
  9.         }
  10. [code/]
« Last Edit: February 02, 2015, 10:55:09 AM by BillZndl »

kees987

  • Guest
Re: Question about Rotation
« Reply #3 on: February 02, 2015, 03:53:01 PM »
Thanks :)
Works like a charm now.