- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi to everybody,
I have a little question for the group members'
Here attached an image which could help the question understanding.
I have a drawing with several points, near each point there is a text which identify the "name" of points, and of course text it's present also into the entire drawing, but I have to catch the only text near the point (by VBA).
In order to do this I thought to catch the point coordinates, drawn a temporary circle of certain diameter (enough to be sure that text could be covered [intersecting or inside]) and having the text insertion point check if there is an intersection.
I don't know where the text has been drawn compared with point, it could be placed around the point, but I have to cover a 360° potential position and distance from point detected.
But I'm facing a little problem, seems that text and circle are not intersecting between. I know that text could be on a specific layer, but I want to be sure to catch exactly text near the point. I don't know the text alignment.
Here below also a sample code, the variable which could indicate the intersection point will return empty value.
Sub FindText()
For Each PntObject In ThisDrawing.ModelSpace
If TypeOf PntObject Is AcadPoint Then
If PntObject.Layer = "POINTS" Then
PntObjectIns = PntObject.Coordinates
For Each TxtObject In ThisDrawing.ModelSpace
If TypeOf TxtObject Is AcadText Then
If TxtObject.Layer = "POINTS_LABEL" Then
TXT_inspoint = TxtObject.InsertionPoint
Set circleObj = ThisDrawing.ModelSpace.AddCircle(PntObjectIns, 28.1026)
intPoints = circleObj.IntersectWith(TxtObject, acExtendNone)
PointInsertion_Form.CoordsListBox.AddItem (TxtObject.TextString)
circleObj.Delete
'End If
End If
End If
Next
End If
End If
Next
PointInsertion_Form.show
End Sub
Every kind of help or suggestions will be accepted.
Thank you.
Solved! Go to Solution.