27 | 07 | 2017

Mirror Entity

Code below shows how to mirror a entity. The sample uses a box object to show how it works but you can use any entity for it.

Sub MirrorObject()
'***************************************
'**** Code From VisibleVisual.com ******
'**** Free To Use                 ******
'***************************************
On Error GoTo ErrorHandler
    'First we create a Box as a sample entity
    Dim boxObj As Acad3DSolid
    Dim Origin(0 To 2) As Double
    Dim Length As Double
    Dim Width As Double
    Dim Height As Double
    Origin(0) = 200#: Origin(1) = 0#: Origin(2) = 0#
    Length = 100
    Width = 200
    Height = 100
    Set boxObj = ThisDrawing.ModelSpace.AddBox(Origin, Length, Width, Height)
    ZoomAll
    '-------------------------------------
    'Define the mirror axis (Setting below wil mirror over the Y axis)
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    point1(0) = 0: point1(1) = 0: point1(2) = 0
    point2(0) = 0: point2(1) = 1: point2(2) = 0
    ' Mirror over the polyline
    Dim mirrorObj As AcadBlockReference
    Set mirrorObj = boxObj.Mirror(point1, point2)
    'Use the line below to delete the original entity
    'boxObj.Delete
Exit Sub
ErrorHandler:
MsgBox Err.Description
End Sub
Login

Sign up now and upload your code to the website.

Help us to continue.....
Statistics
Articles View Hits
2311491
Latest Articles