Jump to content

How do I calculate the closest point on an arc to a selected point?


Hudson

Recommended Posts

Is the most efficient to do this to test every point on the arc in a loop?

 

Or is there a better way?

 

Thanks for any and all input

 

Andrew

Link to comment
Share on other sites

As an example:

 

(defun c:test (/ pt ent cLs)
 (vl-load-com)

 (if (and (setq ent (car (entsel "\nSelect an Object: ")))
          (setq pt (getpoint "\nSelect a Point to Test: ")))
   (progn

     (setq cLs (vlax-curve-getClosestPointto ent pt))


     ;; --  Display Point  --

     (setvar "PDMODE" 34)
     (vla-addPoint
       (vla-get-ModelSpace
         (vla-get-ActiveDocument
           (vlax-get-acad-object)))
       (vlax-3D-point cLs))))  

 (princ))
       

Link to comment
Share on other sites

  • 2 years later...

If memory serves VLAX specifies a Visual LISP ActiveX function prefix. ... It (my memory) didn't. :rofl: See next post.

 

** Edit - Just wanted to get my guess in before Lee's (correct) answer. :P LoL

Link to comment
Share on other sites

Aha... Found it!

 

Lee's post here clarifies the different function prefixes that Visual LISP uses. :thumbsup:

 

Thanks. They are far beyond my knowledge and I don't think I can use them.

Link to comment
Share on other sites

Thanks. They are far beyond my knowledge and I don't think I can use them.

 

Not at all... It may just take some time to understand how they work, and how to properly use them. :)

 

Have you tried Lee's code in post #4? :unsure:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...