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)
THIS MIGHT BE FUN.
from the command line:
(SETQ IT (ENTGET (CAR (ENTSEL))))
pick on of your circle entities.
cut and paste the dxf code for the entity to the board and we can all
see what we are talking about.
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:
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")
On Error GoTo 0
iCode(0) = 0: vData(0) = "CIRCLE"
iCode(1) = 1001: vData(1) = "ACAD"
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,
''The next 2 lines should be adjusted to do what you want.
oText.Alignment = acAlignmentCenter
oText.TextAlignmentPoint = oCirc.Center
Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here.
All logos and trade names are the property of their respective owners.