Jump to content

Point at intersection ( issue )


Recommended Posts

Posted
(foreach pnt (vlax-invoke (vlax-ename->vla-object (car (entsel))) 'intersectwith (vlax-ename->vla-object (car (entsel))) acextendnone)
    (entmake (list (cons 0 "POINT") (cons 10 pnt)))
)

 

Please help , This Code is Not Working in The Attached Example File., I don't know why !!

it works for other polyline intersections except for these in the example file

NoteI can't use ( acextendboth ) I need to insert a point at a real intersection, not an extended intersection

Test Intersections.dwg

Posted

You simply don't have an intersection!
What deceives you; is that you have arc segments and with the graphics resolution it appears to you that you have an intersection.
But if you zoom in very hard to the supposed intersection and do a forced REGEN, you will see that the arc deviates from your straight segment.

Also your code is not reliable, here is my proposal:

 

((lambda ( / pnt lst_pt)
  (setq pnt (vlax-invoke (vlax-ename->vla-object (car (entsel))) 'intersectwith (vlax-ename->vla-object (car (entsel))) acextendnone))
  (if pnt
    (if (> (length pnt) 3)
      (repeat (/ (length pnt) 3)
        (setq
          lst_pt (cons (list (car pnt) (cadr pnt) (caddr pnt)) lst_pt)
          pnt (cdddr pnt)
        )
      )
      (setq lst_pt (cons pnt lst_pt))
    )
  )
  (foreach pnt lst_pt (entmake (list (cons 0 "POINT") (cons 10 pnt))))
))

 

Posted
1 hour ago, Tsuky said:

You simply don't have an intersection!
What deceives you; is that you have arc segments and with the graphics resolution it appears to you that you have an intersection.
But if you zoom in very hard to the supposed intersection and do a forced REGEN, you will see that the arc deviates from your straight segment.

Also your code is not reliable, here is my proposal:

 

((lambda ( / pnt lst_pt)
  (setq pnt (vlax-invoke (vlax-ename->vla-object (car (entsel))) 'intersectwith (vlax-ename->vla-object (car (entsel))) acextendnone))
  (if pnt
    (if (> (length pnt) 3)
      (repeat (/ (length pnt) 3)
        (setq
          lst_pt (cons (list (car pnt) (cadr pnt) (caddr pnt)) lst_pt)
          pnt (cdddr pnt)
        )
      )
      (setq lst_pt (cons pnt lst_pt))
    )
  )
  (foreach pnt lst_pt (entmake (list (cons 0 "POINT") (cons 10 pnt))))
))

 

 

Thanks for replying ...
I tried the code but it gave ( nil ), I also checked the intersection and zoomed as far as I could and I saw the intersection

Posted

If the function returns nil, no intersection was found!
To see that your segment is not touching the arc, it may be necessary to repeat the operation several times (because the gap is very small): zoom -> regen

Posted
7 minutes ago, Tsuky said:

If the function returns nil, no intersection was found!
To see that your segment is not touching the arc, it may be necessary to repeat the operation several times (because the gap is very small): zoom -> regen

 

If there is a gap .. when I try to make ( Extend ) it will accept 

Posted

Quite!
but you say:
 

Quote

Note: I can't use ( acextendboth ) I need to insert a point at a real intersection, not an extended intersection

You are within detection limits...
Either you agree to have expanded intersections, or you ban them, it's your choice!

  • Agree 1

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