Author Topic: Cut polyline out of two points  (Read 229 times)

0 Members and 1 Guest are viewing this topic.

doductiep

  • Mosquito
  • Posts: 3
Cut polyline out of two points
« on: September 12, 2021, 06:36:50 AM »
I have two points on a polyline, the Pline  is unClosed. Now I want to reject part of Pline out of two points by autolisp (please view the attachment figure)
Please help me, Thanks all



HOSNEYALAA

  • Newt
  • Posts: 76
Re: Cut polyline out of two points
« Reply #1 on: September 12, 2021, 12:23:04 PM »


Lee Mac

  • Seagull
  • Posts: 12514
  • London, England
Re: Cut polyline out of two points
« Reply #3 on: September 12, 2021, 05:02:53 PM »
http://www.lee-mac.com/offsetpolysection.html

Thanks for the recommendation HOSNEYALAA.

@doductiep, simply comment lines 25-32 and replace lines 131-133 in my program with:
Code: [Select]
(entdel (cdr (assoc -1 e)))

BIGAL

  • Swamp Rat
  • Posts: 820
  • 30 + years of using Autocad
Re: Cut polyline out of two points
« Reply #4 on: September 12, 2021, 08:43:32 PM »
Why not 2 point circle then offset out, use trim. Note thought the pickbox sizing comes into affect so if set offset dist to small the pick point will not work.

Code: [Select]
; trim a pline outside using a 2 point circle
; By Alanh info@alanh.coma.au SEP 2021

(defun c:ctr ( / oldsnap pt1 pt2 obj1 obj2 obj3 intpts)

(setq pt1 (getpoint "\Pick point 1 ") pt2 (getpoint "\Pick point 2 "))

(setq obj1 (vlax-ename->vla-object (ssname (ssget pt1) 0)))

(command "circle" "2p" pt1 pt2)
(setq obj2 (entlast))

(vla-offset (vlax-ename->vla-object  obj2) 10)
(setq obj3 (vlax-ename->vla-object (entlast)))

(setq intpts (vlax-invoke obj3 'intersectWith obj1 acExtendnone))

(vla-delete obj3)

(command "trim" obj2 "" "near" (list (nth 0 intpts)(nth 1 intpts)) "near" (list (nth 3 intpts)(nth 4 intpts)) "")
(command "erase" obj2 "")

(princ)
)
(c:ctr)
A man who never made a mistake never made anything

doductiep

  • Mosquito
  • Posts: 3
Re: Cut polyline out of two points
« Reply #5 on: September 12, 2021, 09:24:41 PM »
Thank @Lee Mac and @Bigal, your program are work very well

ScottMC

  • Newt
  • Posts: 87
  • ...if we don't ask, we won't receive..
Re: Cut polyline out of two points
« Reply #6 on: September 13, 2021, 08:38:52 PM »
Lee Mac has it.. Thanks!