Copying Objects

Use the Copy method to copy an existing drawing object. The new object occupies the same position as the original object and is drawn on top of all other objects. This method has the following syntax:

Set DrawingObject = DrawingObject.Copy

The following code asks the user to pick a drawing object from the screen. It then copies the object and moves it to a point the user chooses.

Public Sub CopyObject()

Dim objDrawingObject As AcadEntity Dim objCopiedObject As Object Dim varEntityPickedPoint As Variant Dim varCopyPoint As Variant

On Error Resume Next

ThisDrawing.Utility.GetEntity objDrawingObject, varEntityPickedPoint, _

"Pick an entity to copy: " If objDrawingObject Is Nothing Then MsgBox "You did not pick an object" Exit Sub End If

'Copy the object

Set objCopiedObject = objDrawingObject.Copy()

varCopyPoint = ThisDrawing.Utility.GetPoint(, "Pick point to copy to: ")

'put the object in its new position objCopiedObject.Move varEntityPickedPoint, varCopyPoint objCopiedObject.Update

End Sub

Was this article helpful?

+1 0
100 Bowling Tips

100 Bowling Tips

Playing bowling with your friends can help you decide if it is indeed the hobby that you want to invest your time on today. Aside from that, it can help you get a better feel of the sport. More importantly, when you play with your friends, it would become a more fun activity, which you can look forward to each week.

Get My Free Ebook

Post a comment