TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: doductiep on September 12, 2021, 06:36:50 AM

Title: Cut polyline out of two points
Post by: doductiep 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


Title: Re: Cut polyline out of two points
Post by: HOSNEYALAA on September 12, 2021, 12:23:04 PM
http://www.lee-mac.com/offsetpolysection.html
Title: Re: Cut polyline out of two points
Post by: doductiep on September 12, 2021, 12:32:58 PM
http://www.lee-mac.com/offsetpolysection.html
Thanks bro
Title: Re: Cut polyline out of two points
Post by: Lee Mac 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)))
Title: Re: Cut polyline out of two points
Post by: BIGAL 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)
Title: Re: Cut polyline out of two points
Post by: doductiep on September 12, 2021, 09:24:41 PM
Thank @Lee Mac and @Bigal, your program are work very well
Title: Re: Cut polyline out of two points
Post by: ScottMC on September 13, 2021, 08:38:52 PM
Lee Mac has it.. Thanks!