xentselx + vlax-curve-getclosestpointto

John Uhden

Usenet Archive
Joined
Jul 3, 2003
Messages
330
Reaction score
0
Okay, the WCS2OCS thing is hopefully working, BUT:

I still have this annoying problem with the fact that the (xentselx) functions return the pick point without any meaningful Z value. I've complained about this before. Suppose you want to pick a segment of a 3DPolyline (nested or not). An (osnap pt "_quick,_near") might find a point on another nearby object. A (vlax-curve-getclosestpointto) might find a different segment because the distance is affected by the Z values.

Example:
Command: (command "_.3dpoly")(mapcar 'command '((0 0 100)(10 10 110)(20 20 120) "")) _.3dpoly Specify start point of polyline:
Specify endpoint of line or [Undo]:
Specify endpoint of line or [Undo]:
Specify endpoint of line or [Close/Undo]:
Command: (nil nil nil nil)

Command: (setq pick (nentselp '(14.99 15.01)))
(<Entity name: 400b7de8> (14.99 15.01 0.0))

Command: (setq object (vlax-ename->vla-object (entlast))) #<VLA-OBJECT IAcad3DPolyline 025f6904>

Command: (vlax-curve-getclosestpointto object (cadr pick))
(0.0 0.0 100.0)

Anyone care to propose a solution to getting the correct point?
 
Perhaps using the appropriate tool for the job
might work:

vlax-curve-GetClosestPointToProjection
 
Hey John, here's a thought - have you tried using
vlax-curve-GetClosestPointToProjection?

jb
 
Thank you kindly, Tony/James. Why did I never see that one before!? Now I'm a little daunted by what 'Normal to use when the object is nested... the nested object's normal? it's parent's normal? or just plain '(0 0 1)?

Tony Tanzillo said:
Perhaps using the appropriate tool for the job
might work:

vlax-curve-GetClosestPointToProjection

Okay, the WCS2OCS thing is hopefully working, BUT:

I still have this annoying problem with the fact that the (xentselx) functions return the pick point without any meaningful Z value. I've complained about this before. Suppose you want to pick a segment of a 3DPolyline (nested or not). An (osnap pt "_quick,_near") might find a point on another nearby object. A (vlax-curve-getclosestpointto) might find a different segment because the distance is affected by the Z values.

Example:
Command: (command "_.3dpoly")(mapcar 'command '((0 0 100)(10 10 110)(20 20 120) "")) _.3dpoly Specify start point of polyline:
Specify endpoint of line or [Undo]:
Specify endpoint of line or [Undo]:
Specify endpoint of line or [Close/Undo]:
Command: (nil nil nil nil)

Command: (setq pick (nentselp '(14.99 15.01)))
(<Entity name: 400b7de8> (14.99 15.01 0.0))

Command: (setq object (vlax-ename->vla-object (entlast))) #<VLA-OBJECT IAcad3DPolyline 025f6904>

Command: (vlax-curve-getclosestpointto object (cadr pick))
(0.0 0.0 100.0)

Anyone care to propose a solution to getting the correct point?
 
John,
If you are worried about what point the pick point appears close to then I would imagine you would need the normal of the DCS.

(trans '(0 0 1) 2 0)
 
Thanks, Doug. I expect a little experimentation is in order. But with the usual collection of brains contributing, we may be able to nail it down. Tony is probably the most capable of unraveling the mysteries, but I wish Jon Fleming would participate a little more. I sorta think of him as the transformation meister. Then again, it was Larry Leuallen who unraveled the inverse matrix method.

Just an aside, but are the regulars maybe getting bored of this scene?
 
Hi John,

Just pretty busy. I try to participate when its of interest and I don't think its going to take hours. A lot of the questions lately haven't been all that interesting. There have been a lot of folks looking for handouts without much real learning happening.

I am curious why the trans function hasn't come up in a few of these threads or why the getucsmatrix and transformby methods haven't been discussed. Transforming points is one thing but drawing entities normal to another ucs seems to require different strategies IMO. Course I could be getting past it.

Seemed like the discussions a year ago were much more
alive with people learning the new methods.

Thanks for keeping the level of the discussion up! I imagine there are still lurkers out there who are benefitting.

About inverse matricies, I'm afraid the concepts probably did not originate with Larry or Jon, although they may have posted the earliest AutoLISP ones. I didn't check the newsgroups till 2 years ago. I remember reading about 3d transformation using matricies when I was in college(long before AutoCAD). I had to program my own CAD system circa 1980 on a Textronix terminal using the campus IBM 360 and the APL language to draw my thesis project. APL is marvelous for that stuff. I was able to design and draw an amphitheater for 5000 and show and plot the drawings in isometric section and plan.

Regards,
Doug
 
Wow! Now my dreams tonight will be 4-dimensional! ((Z Z Z Z)(Z Z Z etc.))
 
Back
Top