how to place a circle on a line AutoCAD & VBA w/code
Hey all long time no see!
This is some generic code that was on the net, if I wanted to place a circle at a line selected how would I do that; see comment in code at entLine: My idea was to place a circle at the selected lines mid point with a .25" rad
Thanks for any help with this.
[VBA]
Sub GetLengths()
Dim SOS As AcadSelectionSet
Dim objSS As AcadSelectionSet
Dim intCode(0) As Integer
Dim varData(0) As Variant
Dim objEnt As AcadEntity
Dim entLine As AcadLine
Dim entPoly As AcadPolyline
Dim entLWPoly As AcadLWPolyline
For Each SOS In ThisDrawing.SelectionSets
If SOS.Name = "MySS" Then
ThisDrawing.SelectionSets("MySS").Delete
Exit For
End If
Next
intCode(0) = 0: varData(0) = "LINE,POLYLINE,LWPOLYLINE"
ThisDrawing.SelectionSets.Add ("MySS")
Set objSS = ThisDrawing.SelectionSets("MySS")
objSS.SelectOnScreen intCode, varData
If objSS.Count < 1 Then
MsgBox "No lines and polylines selected!"
Exit Sub
End If
For Each objEnt In objSS
Select Case objEnt.ObjectName
Case "AcDbLine"
Set entLine = objEnt
'** Place circle around this line **
MsgBox "Line is " & entLine.Length & " units long."
Case "AcDb2dPolyline"
Set entPoly = objEnt
MsgBox "Polyline is " & entPoly.Length & " units long."
Case "AcDbPolyline"
Set entLWPoly = objEnt
MsgBox "LightWeight Polyline is " & entLWPoly.Length & " units long."
End Select
Next
End Sub
[/VBA]