티스토리 뷰

반응형

오토캐드 vba로 스트레치 명령 사용해 보기 stretch

 

캐드로 스트래치를 마음대로 조절할 수만 있다면 수많은 작업을 편하게 하지 않을까 싶어서 많이 찾아보고 있는데,

이런 정보가 있어서 함께 공유합니다.

함수를 하나 만드는 방법 1번,

Public Sub StretchEntity()

    Dim ss As AcadSelectionSet
    Set ss = ThisDrawing.SelectionSets.Add("MySS")
    ss.Select acSelectionSetAll
    
    Dim ent As AcadEntity
    Dim line As AcadLine
    
    For Each ent In ss
        If TypeOf ent Is AcadLine Then
            Set line = ent
            StretchLine line
        End If
    Next
    
    ss.Delete
    
End Sub

Private Sub StretchLine(line As AcadLine)

    Dim pt As Variant
    Dim basePt As Variant
    basePt = line.StartPoint
    
    pt = ThisDrawing.Utility.GetPoint(basePt, vbCr & "Stretch the line's end point to:")
    
    line.EndPoint = pt
    line.Update

End Sub

 

명령어창을 이용하는 방법도 있네요. 2번째 해법...

Public Sub testStretch()
' keep left button when specify other corner
Dim comm As String
comm = "_stretch _c pause "
ThisDrawing.SendCommand comm

End Sub

 

실전에서 사용할 수 있도록 더 노력해야 겠네요.

반응형
댓글