Using ArrayRectangular at an angle???

Using ArrayRectangular at an angle???

Anonymous
Not applicable
414 Views
3 Replies
Message 1 of 4

Using ArrayRectangular at an angle???

Anonymous
Not applicable
Hi

I'm trying to use ArrayRectangular to create an array of a line.
To create it at an angle the help says use SnapRotationAngle or Snapang
to set the cross-hairs to the desired angle. But I'm damned if I can
work it out. The routine below creates an array, but orthogonal to X & Y
irrespective of the rotation of the cross-hairs.

What am I doing wrong?
Your help would be greatly appreciated.

Cheers
Dave F.

Sub ArrayRectangular_test()
Dim DivArr As Variant
Dim Ent As AcadEntity
Dim EntPt As Variant

ThisDrawing.ActiveViewport.SnapRotationAngle = dtr(45) 'rotationangle
ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport

'ThisDrawing.SetVariable "snapang", dtr(60)
ThisDrawing.Regen acActiveViewport
ThisDrawing.Utility.GetEntity Ent, EntPt, "Select Entity to Offset"
DivArr = Ent.ArrayRectangular(4, 2, 1, 200, 1, 1)
End Sub
0 Likes
415 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Hi Dave
I thought maybe you can to store old UCS,
then create the new one that is rotated at 60 d,
around Z axis then run procedure and restore UCS
at the end
Or you can to use SendCommand method:

Sub ArrayRectangular_test()
Dim DivArr As Variant
Dim Ent As AcadEntity
Dim EntPt As Variant
Dim pi As Double
pi = Atn(1#) * 4
ThisDrawing.ActiveViewport.SnapRotationAngle = pi / 3 'rotationangle <--superfluous?
'ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
Dim comStr As String
comStr = "UCS _Z " & CStr(pi / 3) & vbCr
ThisDrawing.SendCommand comStr
'ThisDrawing.SetVariable "snapang", dtr(60)
'ThisDrawing.Regen acActiveViewport
ThisDrawing.Utility.GetEntity Ent, EntPt, "Select Entity to Offset"
DivArr = Ent.ArrayRectangular(4, 2, 1, 200, 1, 1)
comStr = "UCS _P "
ThisDrawing.SendCommand comStr
End Sub
0 Likes
Message 3 of 4

Anonymous
Not applicable
Thanks for that Mr. Fatty.

Yours works.

Robert Bell over at AUGI thinks it's a bug. I'm using '07. I guess it's
the same in '08 :-(.

This routine flags up another problem - setting the UCS about the Z
axis. I've seen posts saying it can be set using the X & Y values but
none give an example & everyone seems to do what you've done & use the
dreaded (but easiest) SendCommand.

Does anyone know how to set it properly?

Cheers
Dave F.

Fatty wrote:
> Hi Dave
> I thought maybe you can to store old UCS,
> then create the new one that is rotated at 60 d,
> around Z axis then run procedure and restore UCS
> at the end
> Or you can to use SendCommand method:
>
> Sub ArrayRectangular_test()
> Dim DivArr As Variant
> Dim Ent As AcadEntity
> Dim EntPt As Variant
> Dim pi As Double
> pi = Atn(1#) * 4
> ThisDrawing.ActiveViewport.SnapRotationAngle = pi / 3 'rotationangle <--superfluous?
> 'ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
> Dim comStr As String
> comStr = "UCS _Z " & CStr(pi / 3) & vbCr
> ThisDrawing.SendCommand comStr
> 'ThisDrawing.SetVariable "snapang", dtr(60)
> 'ThisDrawing.Regen acActiveViewport
> ThisDrawing.Utility.GetEntity Ent, EntPt, "Select Entity to Offset"
> DivArr = Ent.ArrayRectangular(4, 2, 1, 200, 1, 1)
> comStr = "UCS _P "
> ThisDrawing.SendCommand comStr
> End Sub
that Mr. Fatty
0 Likes
Message 4 of 4

Anonymous
Not applicable
Hi Dave,
Sorry I haven't a solution yet
Better to say I haven't a time on that
at the moment
Try to search this NG how to change
and restore UCS

~'J'~
0 Likes