Computer Aided Automation
Simple AutoCAD VBA code to draw circle - Printable Version

+- Computer Aided Automation (https://www.computeraidedautomation.com)
+-- Forum: VBA Programming (https://www.computeraidedautomation.com/forumdisplay.php?fid=1)
+--- Forum: AutoCAD VBA (https://www.computeraidedautomation.com/forumdisplay.php?fid=2)
+--- Thread: Simple AutoCAD VBA code to draw circle (/showthread.php?tid=2)



Simple AutoCAD VBA code to draw circle - CAA - 07-25-2019

Function drawcircle(ByVal x1c As Double, ByVal y1c As Double, ByVal r1c As Double, ByVal cc As Integer)
Dim Centerpoint(0 To 2) As Double

Dim CirObj As AcadCircle
  'Start Coordinates Coordinates XYZ
Centerpoint(0) = x1c: Centerpoint(1) = y1c: Centerpoint(2) = 0
'End Coordinates Coordinates XYZ

'Line object in to drawing space

Set CirObj = ThisDrawing.ModelSpace.AddCircle(Centerpoint(), r1c)

Select Case cc

Case 1
CirObj.color = acWhite
CirObj.Update

Case 2
CirObj.color = acCyan
CirObj.Update

Case 3
CirObj.color = acGreen
CirObj.Update

Case 4
CirObj.color = acRed
CirObj.Update

Case 5
CirObj.color = acYellow
CirObj.Update

Case 6
CirObj.color = acBlue
CirObj.Update

Case 7
CirObj.color = acMagenta
CirObj.Update

Case Else
'LinObj.color = acWhite
CirObj.Update
End Select

End Function