Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple AutoCAD VBA code to draw circle
#1
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)