Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone, I'm trying to rotate a selection set, every section of the code seems to be sorking ok, but at the very end, when I try to rotate all of the drawing, it gives the following error:
"Compile error, Expected Function or variable"
Ay ideas how can I make my code work?
My code looks like this:
Sub Rotation()
Dim pointObj As AcadPoint
Dim location(0 To 2) As Double
location(0) = 0#: location(1) = 0#: location(2) = 0#
Set pointObj = ThisDrawing.ModelSpace.AddPoint(location)
Dim oObj(500) As AcadEntity
Dim oSelSet As AcadSelectionSet
Dim i As Integer
i = 0
Dim Angle As Double
Angle = 90
Dim tSelSet As AcadSelectionSet
On Error Resume Next
Set tSelSet = ThisDrawing.SelectionSets.Add("XX")
If tSelSet Is Nothing Then
Set tSelSet = ThisDrawing.SelectionSets.Item("XX")
tSelSet.Clear
End If
For i = 1 To 500
Set oObj(i) = ThisDrawing.ModelSpace.Item(i)
Next
oSelSet.AddItems (oObj)
For i = 1 To oSelSet.Count
Set oObj(i) = oSelSet.Item(i).Rotate(pointObj, Angle)
Next i
End Sub
Solved! Go to Solution.