Jump to content

After trimming a line with a poly line how can I get the coordinates of trimmed point


Dayananda

Recommended Posts

(command "line""non"p1"non"p2""); 1: 1.5 filling line
(setq ent1 (entlast))
  
(setq ent2  (car(entsel "\nSelect existing ground line")))
(command "trim"ent2""ent1"")

 

Link to comment
Share on other sites

Compare the new endpoints of ent1 to p1 and p2 one will match the one that doesn't is the new trim point.

 

-edit

 

You could also use visual lisp. might need to use (vl-load-com)

(setq pt (vla-intersectwith (vlax-ename->vla-Object ent1) (vlax-ename->vla-Object ent2) acextendnone))
(setq pt (vlax-safearray->List (vlax-variant-vaLue pt)))

 

Edited by mhupp
  • Thanks 1
Link to comment
Share on other sites

Capture.PNG.7b8877b91a8ef9f1727aa2db93f7f631.PNG

3 hours ago, mhupp said:
(setq pt (vla-intersectwith (vlax-ename->vla-Object ent1) (vlax-ename->vla-Object ent2) acextendnone))
(setq pt (vlax-safearray->List (vlax-variant-vaLue pt)))

Your code is working perfect. but in some case the decimals are round off. how  can I solve this.

I mean when I select a small line using entsel the final result is coordinates of both end are same.

Picture attached. (units meters)

Link to comment
Share on other sites

I Think that has something to do with how you setup the drawing or created the line. entsel doesn't round numbers.

 

in this example my linear precision is set to 4 but still shows 13 digits for 10 & 11 points

image.png.fb9fa8aad650e5882e73c5c101d5f627.png

 

 

 

 

 

 

Edited by mhupp
  • Like 2
Link to comment
Share on other sites

18 hours ago, mhupp said:

Compare the new endpoints of ent1 to p1 and p2 one will match the one that doesn't is the new trim point.

 

-edit

 

You could also use visual lisp. might need to use (vl-load-com)

(setq pt (vla-intersectwith (vlax-ename->vla-Object ent1) (vlax-ename->vla-Object ent2) acextendnone))
(setq pt (vlax-safearray->List (vlax-variant-vaLue pt)))

 

I am in a trouble again. When two lines are not intersect each other I cant proceed to next level. Pl.  help

Link to comment
Share on other sites

Change how you see fit


 

(setq pt (vla-intersectwith (vlax-ename->vla-Object ent1) (vlax-ename->vla-Object ent2) acextendnone)) ;change option here
(setq pt (vlax-safearray->List (vlax-variant-vaLue pt)))

 

current

acextendnone  -  Do not extend entity's

 

other options

acextendthisentity - Extend ent1 to meet ent2

acextendotherentity - Extend ent2 to meet ent1

acextendboth - Extend both entity's

  • Thanks 1
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...