Guys,
I have a drawing in which all the lines are slightly off the axis. That means, It can be 0.0003495 degree, 0.008565 degree, 0.0306795 degree etc...instead of a horizontal line. I though of writing a macro to correct these lines. But, the final rotation is not happening properly.Can someone help me..??
Code:
Private Sub CommandButton1_Click()
Me.Hide
Dim LineObject As AcadLine
Dim StPo As Variant
Dim BasePoints(0 To 2) As Double
Dim Sset As AcadSelectionSet
Dim LAng, rotationAngle As Double
Dim Ang As Integer
Set Sset = ThisDrawing.ActiveSelectionSet
Sset.SelectOnScreen
For Each LineObject In Sset
StPo = LineObject.StartPoint
BasePoints(0) = StPo(0)
BasePoints(1) = StPo(1)
BasePoints(2) = StPo(2)
LAng = LineObject.Angle ' Stores the angle a Double
Ang = LAng ' Stores the angle as integer
rotationAngle = LAng - Ang ' Gets the difference in Angle
rotationAngle = rotationAngle * 0.0174532925 ' Converting angle to radians
LineObject.Rotate BasePoints, rotationAngle
Update
Next
Me.Show
End Sub