Adesu
2008-07-09, 12:37 AM
HI All,
here my code to create line and circle with select option, I still confuse in function select case,
please guide me to become true way.
I very appreaciated for your help.
Sub test1()
Dim ObjLin As AcadLine
Dim ObjCir As AcadCircle
Dim Pt As Variant
Dim Opt As String
Dim StartPnt As Variant
Dim EndPnt As Variant
Dim Rad As Variant
StartPnt = ThisDrawing.Utility.GetPoint(, "Click any location as base point ")
Opt = ThisDrawing.Utility.GetString(1, vbCrLf & "Enter (L)ine or (C)ircle: ")
Opt = UCase(Opt)
Select Case Opt
Case "L"
EndPnt = ThisDrawing.Utility.PolarPoint(StartPnt, 0, 100)
Set ObjLin = ThisDrawing.ModelSpace.AddLine(StartPnt, EndPnt)
Case "C"
Rad = ThisDrawing.Utility.PolarPoint(StartPnt, 0, 10)
Set ObjCir = ThisDrawing.ModelSpace.AddCircle(StartPnt, Rad)
Case Else
If Not ("L" And "C") Then MsgBox "Invalid selected option"
End Select
End Sub
here my code to create line and circle with select option, I still confuse in function select case,
please guide me to become true way.
I very appreaciated for your help.
Sub test1()
Dim ObjLin As AcadLine
Dim ObjCir As AcadCircle
Dim Pt As Variant
Dim Opt As String
Dim StartPnt As Variant
Dim EndPnt As Variant
Dim Rad As Variant
StartPnt = ThisDrawing.Utility.GetPoint(, "Click any location as base point ")
Opt = ThisDrawing.Utility.GetString(1, vbCrLf & "Enter (L)ine or (C)ircle: ")
Opt = UCase(Opt)
Select Case Opt
Case "L"
EndPnt = ThisDrawing.Utility.PolarPoint(StartPnt, 0, 100)
Set ObjLin = ThisDrawing.ModelSpace.AddLine(StartPnt, EndPnt)
Case "C"
Rad = ThisDrawing.Utility.PolarPoint(StartPnt, 0, 10)
Set ObjCir = ThisDrawing.ModelSpace.AddCircle(StartPnt, Rad)
Case Else
If Not ("L" And "C") Then MsgBox "Invalid selected option"
End Select
End Sub