autocad

Move Coordinates of Polyline After It Is Already Drawn

Sub MoveCoordinatesPolylineAfterAlreadyDrawn()
    

    Dim VFG(7) As Double
    Dim retCoord(0 To 1) As Double

    Set acadApp = GetObject(, "AutoCAD.Application")
    Set acadDoc = acadApp.ActiveDocument

    Set objss = acadDoc.SelectionSets.Add("ToErase")
    objss.Select acSelectionSetAll
    objss.Erase
    objss.Delete
    
    VFG(0) = 0: VFG(1) = 0   'vertex 1
    VFG(2) = 0: VFG(3) = -5 'vertex 2
    VFG(4) = 10: VFG(5) = -5 'vertex 3
    VFG(6) = 10: VFG(7) = 0 'vertex 4
   
    Set plineObjLW_a = acadDoc.ModelSpace.AddLightWeightPolyline(VFG)
    plineObjLW_a.Closed = True
    
    retCoord(0) = 2
    retCoord(1) = 3
    
    plineObjLW_a.Coordinate(3) = retCoord

    
    acadApp.ZoomExtents
    
    acadDoc.Regen acAllViewports
    
 
End Sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s