Jump to content

Recommended Posts

Posted

In vba , we have on error resume next

in lisp what is the option?

on error , it is exited.

 

regards

Kalai

Posted

(if(vlax-safearray->list(vlax-variant-value(vla-intersectwith obj1 obj2 
acExtendNone)))(prompt"nothing")(prompt"ok"))  

the above code doesnot work.

i need to continue with the code if there is no intersection.

It is going to the error function.

Guest kruuger
Posted

try this:

(defun c:TEST (/ A B)
 (if
   (and
     (setq A (car (entsel "\nSelect first object: ")))
     (setq B (car (entsel "\nSelect first object: ")))
   )
   (if
     (vlax-invoke
       (vlax-Ename->vla-Object A)
       'IntersectWith
       (vlax-Ename->vla-Object B)
       acExtendNone
     )
     (princ "ok")
     (princ "bad")
   )
 )
 (princ)
)

k.

Posted

I would also be inclined to use the method utilising vlax-invoke as Kruuger has demonstrated, but if you wanted to follow your original method, here is how it could be accomplished:

 

(defun c:test ( / e1 e2 arr )
 (if
   (and
     (setq e1 (car (entsel "\nFirst Object: ")))
     (setq e2 (car (entsel "\nSecond Object: ")))
   )
   (if
     (minusp
       (vlax-safearray-get-u-bound
         (setq arr
           (vlax-variant-value
             (vla-intersectwith
               (vlax-ename->vla-object e1)
               (vlax-ename->vla-object e2) acextendnone
             )
           )
         )
         1
       )
     )
     (princ "\nDont Intersect.")
     (princ (vlax-safearray->list arr))
   )
 )
 (princ)
)

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