Jump to content

Recommended Posts

Posted

I have a shape roughly the shape of a circle and there is a line drawn through it - so there are two intersection points. I want to find the 2 values of these intersection points how is it done?

I have written code below however pt1 is a variant (2 values) I want 2 separate values. How is it done?

Thanks

 

(setq    enaPline(car (entsel "\nSelect shape : ")))
          ObjName1 (vlax-ename->vla-object enaPline))
          enaLine(car (entsel "\nSelect line : ")))
          ObjName2 (vlax-ename->vla-object enaLine))
          Pt1    (vlax-safearray->list
 (vlax-variant-value
 (vla-IntersectWith ObjName1 ObjName2 acExtendNone))))

Posted

First, please take care that your code has a lot of unbalanced right parenthesis (one on each row)!

 

Second, use the above to subtract required sub-lists (rename the variables as you want):

 
(setq InsPoint1st (list (car Pt1) (cadr Pt1) (caddr Pt1))
     InsPoint2nd (cdddr Pt1))

 

Regards,

Posted

Assuming there are only 2 intersect points...here is another way to do it:

 

(setq enapline (car (entsel "\nSelect shape : "))
     objname1 (vlax-ename->vla-object enapline)
     enaline  (car (entsel "\nSelect line : "))
     objname2 (vlax-ename->vla-object enaline)
     pts      (vlax-invoke objname1 "intersectwith" objname2 acextendnone)
     pt1      (reverse (cdddr (reverse pts)))
     pt2      (cdddr pts)
)

Posted

Many Thanks - that worked well

cheers SM

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