Jump to content

another line-arc intersection question


BIGAL

Recommended Posts

I am sure its a simple fix I am not sure what I am doing wrong. I have searched the forum here and looked at lots of examples which is why I can not see what is wrong.

 

I have a line that intersects an arc, if the line is extended to meet the arc the simple lisp works if the line does not touch can not get it to work and not sure why not with extending entity.

 

(vl-load-com)
(setq obj1 (vlax-ename->vla-object (car(entsel "\nPick arc :"))))
(setq obj2 (vlax-ename->vla-object (car(entsel "\nPick line :"))))
(setq intpt (vlax-invoke obj1 'intersectWith obj2 1))   
; 1 is extend line acExtendthisentity
;(setq intpt (vlax-invoke obj1 'intersectWith obj2 acExtendnone)) 
; 0 is acExtendnone
(command "point" intpt)

(princ)

Link to comment
Share on other sites

You are almost there, try updating

 

(setq intpt (vlax-invoke obj1 'intersectWith obj2 1))

 

to

 

(setq intpt (vlax-invoke obj2 'intersectWith obj1 acExtendThisEntity))

Link to comment
Share on other sites

Found it need to use acExtendOtherEntity its always a simple answer but finding it can be hard sometimes in the help.

 

(setq intpt (vlax-invoke obj1 'intersectWith obj2 acExtendotherEntity))

 

also

(setq intpt (vlax-invoke obj1 'intersectWith obj2 2))

; 2 is acExtendotherEntity

; 3 is acExtendboth

Link to comment
Share on other sites

Thanks jammie getting the order of which one to extend makes the difference. Both ways work.

 

Just a little quirk need to watch out for osnaps can over-ride answer.

Link to comment
Share on other sites

I wanted to show a general example (i.e. not make it specific to a variable), but didn't want to define a function to do it, - perhaps unnecessary, but the cat can be skinned in many ways o:)

Link to comment
Share on other sites

I was always under the impression that you could only call on lambda via one of the apply functions

 

Learn something new everyday

 

Thanks for that

Link to comment
Share on other sites

You are almost there, try updating

 

(setq intpt (vlax-invoke obj1 'intersectWith obj2 1))

to

 

(setq intpt (vlax-invoke obj2 'intersectWith obj1 acExtendThisEntity))

 

Just for the record: (eq acExtendThisEntity 1) => T

Link to comment
Share on other sites

FYI You also can check using:

 

(eval acExtendThisEntity)

or !acExtendThisEntity

I was trying to show that they were equal. I'm not sure why I showed it in code.

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