Dear Thomas
I like your command, and because some time the trimed line is in mass,
so I modify your code and as follows, I hope you dont mind.
;;; Author: Mark Thomas
;;; Function: Quick trim
;;; Allows you to draw a line as a cutting edge
;;; then erases the line when done trimming
;;; Modify:Q.J.Chen
(defun c:qt (/ p1 ent p2 p3 p4 p5 ent op obj ang sset a)
(command "undo" "be")
(setq a (getvar "osmode"))
(setvar "osmode" 0)
(cond
((vl-cmdf "_.line" (setq p1 (getpoint "\nSelect First Point: "))
(setq p2 (getpoint p1 "\nSelect Second Point: "))
""
)
(setq ent (entlast))
(setq p3 (getpoint "\nWhich sides: "))
(setq obj (vlax-ename->vla-object ent))
(setq op (vlax-curve-getclosestpointto obj p3))
(setq ang (angle op p3))
(setq p4 (polar p1 ang 1))
(setq p5 (polar p2 ang 1))
(setq sset (ssget "_f" (list p1 p2)))
(command "_.trim" sset "" "f" p4 p5 "" "")
(command "_.erase" ent "")
)
)
(setvar "osmode" a)
(command "undo" "e")
)
The effect is as follow
but I feel trouble about the number 1 in (setq p4 (polar p1 ang 1)),
I think it should be a very little number, like 0.01 or less,
but when I change it to 0.01, many line cant be trimed.
Is it the wrong of "f" selection method?