View Full Version : point in vla-getentity
avjmail
2008-11-26, 02:45 PM
User selects an object.
I want to know which point was selected.
But MyPoint always has Z coordinat 0,0.
Why it is so? Does vla-getentity work in 2D only?
(vla-getentity
(vla-get-utility
(vla-get-activedocument
(vlax-get-acad-object)))
'MyObject
'MyPoint
"Select the object: "
)
ccowgill
2008-11-26, 03:05 PM
User selects an object.
I want to know which point was selected.
But MyPoint always has Z coordinat 0,0.
Why it is so? Does vla-getentity work in 2D only?
(vla-getentity
(vla-get-utility
(vla-get-activedocument
(vlax-get-acad-object)))
'MyObject
'MyPoint
"Select the object: "
)
check the OSNAPZ System Variable, if it is set to 1, this would explain the 0, if it is set to 0, then presently, I would need more information to help determine the problem. Or it could also be that, as the help says,
The pick point returned by GetEntity does not necessarily lie on the selected object. The returned point represents the location of the crosshairs at the time of selection. The relationship between this point and the object varies depending on the size of the pickbox and the current zoom scale.
avjmail
2008-11-26, 09:29 PM
Yes, OSNAPZ is 0.
I think you are right with citate from help; it's impossible to get the point with (vla-getentity) or (entsel).
ccowgill
2008-12-01, 02:24 PM
Yes, OSNAPZ is 0.
I think you are right with citate from help; it's impossible to get the point with (vla-getentity) or (entsel).what if you use the getpoint function to select a point, and just tell AutoCAD to only allow the selection of a node? Or if you are selecting an object that has elevation, tell it to grab the z coord of the insertionpoint
irneb
2008-12-01, 07:28 PM
What about asking the user to pick the entity through getpoint (which allows osnaps as well and should give Z values if OSNAPZ=0), then use netselp to actually select the entity at that point?
'gile'
2008-12-01, 08:54 PM
Hi,
vla-GetEntity works the same as entsel function.
PickedPoint coordinates are defined in the current UCS XY plane (contrary to what is said in help file) according to the current view.
To get the picked point on the selected entity, you have to use the osnap function:
(osnap (vlax-safearray->list PickedPoint) "_nea")
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.