Jump to content

Recommended Posts

Posted

I have a variable say named pnt, but it can be either a 2d, 3d list or a visual lisp variant object, the question is how do you recognize this?

 

and when you did how do you get distance of two point objects? I mean what is the (distance) function to use with (vlax-3d-point)?

Posted

 
(cond 
((eq (type pnt) 'Variant)(princ "\nVariant:"))
      ((listp pnt)(princ "\nPoint List")))

 

its either you convert the vairant value to point list (vlax-safearray->list (variant-value pnt))

 

or convert the point list to variant (vlax-3d-point pnt)

Posted

I have a variable say named pnt, but it can be either a 2d, 3d list or a visual lisp variant object, the question is how do you recognize this?

 

(setq p '(0. 0.))
(if (eq (type p) 'LIST)
 (princ (length p)))

 

 

and when you did how do you get distance of two point objects? I mean what is the (distance) function to use with (vlax-3d-point)?

 

(setq p1 (vlax-3d-point '(0. 0. 0.))
     p2 (vlax-3d-point '(5. 0. 0.))
)
(setq dist (distance (vlax-safearray->list (vlax-variant-value p1))
                    (vlax-safearray->list (vlax-variant-value p2))
          )
)

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...