AutoCAD Map 3D Developer
Welcome to Autodesk’s AutoCAD Map 3D Developer Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D Developer topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SelectAtPoint Problem HELP !

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
304 Views, 3 Replies

SelectAtPoint Problem HELP !

Hi All.
I have developed a rather simple VB and Autocad Map program to maintain Street centerlines for a municipality. I am working on a annotation feature so the user can add the street names fairly quickly (by selecting the street, and selecting the start point of the text, it gets the street name from the db). HOWEVER. we want to be able to store info about the annotations in the DB as well so that they could be rebuilt if necessary. Here lies the problem. Im am using send command to create the text on the map. and then i want to get the handle of the newly added text. There seems to be a problem with the selectAtPoint (to add the text object to a selection set) method, sometimes it works, sometimes not. And ive checked the coordinates its using to get the object, and they are fine. I will include a code snippet below. any help/insight/workarounds for this problem would be greatly appreciate. THANKS !! bill


Dim selPnt(2) As Double
Dim ss As AcadSelectionSet
Set ss = ThisDrawing.SelectionSets.Add("ss_centerline")

'insertPnt is the coordinates at which the text was inserted.
selPnt(0) = insertPnt(0)
selPnt(1) = insertPnt(1)
selPnt(2) = 0
SEND COMMAND LINE TO ADD TEXT TO MAP

ss.Clear
ss.SelectAtPoint (selPnt)
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

sorry for the word wraping on the code. What it comes down to is the selection set is 8 times out of 10 empty after the selectAtPoint function is run. So I guess the question comes down to is: a) does anyone see a flaw in my code or b) does anyone know another way I can get the handle of the newly inserted text object.
Message 3 of 4
Anonymous
in reply to: Anonymous

Hi,

If the text is the last entity added to the drawing, you can get it through
VBA code something like this,

Dim count As Integer
count = ThisDrawing.ModelSpace.count 'Get the total number of entities in
Model Space
Dim obj As AcadEntity
Set obj = ThisDrawing.ModelSpace.Item(count - 1) ' Get the last entity added
to model space
...
...
...
...

Hope this helps,

regards,
Raju.K.,
GIS Engineer

"BillMasters" wrote in message
news:f178dab.-1@WebX.maYIadrTaRb...
Hi All.
I have developed a rather simple VB and Autocad Map program to maintain
Street centerlines for a municipality. I am working on a annotation feature
so the user can add the street names fairly quickly (by selecting the
street, and selecting the start point of the text, it gets the street name
from the db). HOWEVER. we want to be able to store info about the
annotations in the DB as well so that they could be rebuilt if necessary.
Here lies the problem. Im am using send command to create the text on the
map. and then i want to get the handle of the newly added text. There seems
to be a problem with the selectAtPoint (to add the text object to a
selection set) method, sometimes it works, sometimes not. And ive checked
the coordinates its using to get the object, and they are fine. I will
include a code snippet below. any help/insight/workarounds for this problem
would be greatly appreciate. THANKS !! bill
Dim selPnt(2) As Double
Dim ss As AcadSelectionSet
Set ss = ThisDrawing.SelectionSets.Add("ss_centerline")
'insertPnt is the coordinates at which the text was inserted.
selPnt(0) = insertPnt(0)
selPnt(1) = insertPnt(1)
selPnt(2) = 0
SEND COMMAND LINE TO ADD TEXT TO MAP
ss.Clear
ss.SelectAtPoint (selPnt)
Message 4 of 4
Anonymous
in reply to: Anonymous

Too easy. Thanks so much.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost