Author Topic: The pick point returned by entsel  (Read 2326 times)

0 Members and 1 Guest are viewing this topic.

velasquez

  • Newt
  • Posts: 195
The pick point returned by entsel
« on: May 13, 2011, 06:16:22 PM »
"The pick point returned by entsel does not represent a point that lies on the selected object. The point returned is the location of the crosshairs at the time of selection. The relationship between the pick point and the object will vary depending on the size of the pickbox and the current zoom scale."

How to convert this point to get on the selected entity?
Eg. I will always select a block.

Thanks



Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: The pick point returned by entsel
« Reply #1 on: May 13, 2011, 06:19:52 PM »
If you need a point on the entity, perhaps use vlax-curve-getclosestpointto

Lee


CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: The pick point returned by entsel
« Reply #2 on: May 13, 2011, 06:41:55 PM »
What he said.
Code: [Select]
;;  CAB 07/29/06
;;  Get an entity with the point on the object.
(defun c:myentsel (/ ent obj pt)
  (vl-load-com)
  (if (setq ent (entsel "\nSelect entity: "))
    (list (car ent)
          (trans (vlax-curve-getclosestpointto (car ent) (trans (cadr ent) 1 0)) 0 1)
    )
  )
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: The pick point returned by entsel
« Reply #3 on: May 13, 2011, 06:50:55 PM »
Don't forget osnap.
Code: [Select]
(setq lst (entsel "\nPick me."))
(setq p (osnap (cadr lst) "nea"))
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: The pick point returned by entsel
« Reply #4 on: May 13, 2011, 07:26:25 PM »
or vlax-curve-getClosestPointToProjection
Man that was a lot to type.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: The pick point returned by entsel
« Reply #5 on: May 14, 2011, 03:24:57 AM »
vlax-curve-getClosestPointTo will work while the current view plane is parallel to the selected object plane.

osnap and vlax-curve-getClosestPointToProjection would work whatever the view direction, but...

... we noticed some strange behaviors with polylines (according to the polyline type).

Code: [Select]
(setq ent (entsel))
These two expressions would return the WCS coordinates of the picked point on the polyline:

Code: [Select]
(trans (osnap (cadr ent) "_nea") 1 0)
Code: [Select]
(vlax-curve-getClosestPointToProjection
  (car ent)
  (trans (cadr ent) 1 0)
  (mapcar '-
  (trans (getvar "VIEWDIR") 1 0)
  (trans '(0 0 0) 1 0)
  )
)

But, the first one may return wrong results with 'old style' 2d polylines and the second one wrong results with 3d polylines.
Both work with lwpolylines.
Speaking English as a French Frog

Jeff H

  • Needs a day job
  • Posts: 6144
Re: The pick point returned by entsel
« Reply #6 on: May 14, 2011, 03:46:26 AM »
I do not know enough about AuotLisp if this is a dumb question or not but would checking PLINETYPE help in getting correct result?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: The pick point returned by entsel
« Reply #7 on: May 14, 2011, 07:12:40 AM »
Thanks for that information gile. 8-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

velasquez

  • Newt
  • Posts: 195
Re: The pick point returned by entsel
« Reply #8 on: May 14, 2011, 07:47:57 AM »
Thank you all for your help.

The bject of my selection will always be a block.
The option to use OSNAP "nea"is working well.