Hi, Included in my drawing are 500 circles as Entitys with Data attached. Each Entity has 7 text felds. I need to label each Entity with a number out of its attached Entity Data.
I wasted 2 Days on this and no success.
Is anyone here with the know how to do this by script (VBA)?
Any hints are welcome.
Many thanks in advance
(I revised the posting because stating Block for Entity firsttime)
That won't quite get it, roy. ;-) Since the data is stored as XDATA you need to ask for that in the (entget)...... (SETQ IT (ENTGET (CAR (ENTSEL)) '("*")))
And as it turns out, Carlito's XDATA is under the basic "ACAD" application name and I sent this code to them:
Sub labelCircles() Dim oSS As AcadSelectionSet Dim oCirc As AcadCircle Dim iCode(1) As Integer Dim vData(1) As Variant Dim iXCode As Variant Dim vXData As Variant Dim dTextSize As Double Dim I As Integer Dim oText As AcadText Dim sStr As String
dTextSize = 1 'adjust as desired
On Error Resume Next Set oSS = ThisDrawing.SelectionSets.Add("MyCircles") If Err Then Set oSS = ThisDrawing.SelectionSets.Item("MyCircles") Err.Clear oSS.Clear End If On Error GoTo 0
oSS.Select acSelectionSetAll, , , iCode, vData For Each oCirc In oSS oCirc.GetXData "ACAD", iXCode, vXData For I = 0 To UBound(vXData) If iXCode(I) = 1000 And InStr(1, vXData(I), "Nr") Then sStr = Mid(vXData(I), 4) Set oText = ThisDrawing.ModelSpace.AddText(sStr, oCirc.Center, dTextSize) ''The next 2 lines should be adjusted to do what you want. oText.Alignment = acAlignmentCenter oText.TextAlignmentPoint = oCirc.Center Exit For End If Next Next End Sub
PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.