kalai Posted July 28, 2011 Share Posted July 28, 2011 In vba , we have on error resume next in lisp what is the option? on error , it is exited. regards Kalai Quote Link to comment Share on other sites More sharing options...
kalai Posted July 28, 2011 Author Share Posted July 28, 2011 (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. Quote Link to comment Share on other sites More sharing options...
Guest kruuger Posted July 28, 2011 Share Posted July 28, 2011 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. Quote Link to comment Share on other sites More sharing options...
kalai Posted July 28, 2011 Author Share Posted July 28, 2011 thanks It works . Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 28, 2011 Share Posted July 28, 2011 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) ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.