TRIM

#1
Is it possible to trim one object back to a line without actually picking the object?

I have an issue with my piping utility as a result of the changes to the REVOLVE command.
(the changes are actually bug fixes)

Where I was able to revolve a closed shape that crossed the revolve axis, this no longer works.

So I can draw the 2d shape as before, I can add a line to trim back to, All works fine, but I am selecting points on the 2D shape.
Here is what I have:

Code: Select all

;--------------------------------------------------------------------
;	-	trim shell to line
	(progn
		(command "ucs" "w" "")
		(command "trim" ENTLN1 ENTDH3 "" TP04 "")
		(setq ENTDH3A (entlast))
		(command "trim" ENTLN1 ENTDH3A "" PT06 "")
		(setq ENTDH3B (entlast))
		(command "trim" ENTLN1 ENTDH3B "" PT02z1 "")
		(setq ENTDH3C (entlast))	
		(command "trim" ENTLN1 ENTDH3C "" TP02z1 "") ;was PT04z1
;-----------end trim shell ***working***
.
The full code in the attached file for context.
While this works, by 'picking' the object, do I run the risk of multiple objects being selected?
and is there a way I can achieve the same result without 'picking' the objects?

I hope that actually makes sense :)
SteveN
Attachments
End Cap - TRIM.zip
(2.57 KiB) Downloaded 12 times

Re: TRIM

#2
Hi Steven,

I'm not sure fully understand your issue, but we can trim an object without picking.
But we must supply a point on the object to complete the command.

Refer this:

Code: Select all

(defun c:TrimX( / pt1 pt2 pt3 pt4 line1 line2)
  (setq pt1 (list 0 0) pt2 (list 10 0)
	pt3 (list 0 10) pt4 (list 10 10))
	
  (setq line1 (entmakex (list (cons 0 "LINE") (cons 10 pt1) (cons 11 pt4))))

  (setq line2 (entmakex (list (cons 0 "LINE") (cons 10 pt2) (cons 11 pt3))))

  (command "trim" line1 line2 "" pt1 "")
  (princ)
  )

Re: TRIM

#3
Hi Quan,

It could be just my ignorance on how the lsp is actually working in detail.

TP04 is a defined point on the object (piping endcap outline), as is PT06, PT02z1. all defined earlier in the routine.
While the endcap shape is a LWPOLYLINE, when the fist trim point is entered only part of the endcap outline is trimmed off, so I have had to repeat the command until all has been trimmed away.

In my mind I had a vision of a 'pickbox' at that point, I think this could be the problem, ie ME!!!!
As you sample is basically the same as mine!

Question:
What will happen if 3 lines cross at the same point? ie existing geometry.

SteveN

Re: TRIM

#4
sln8458 wrote:
Fri Sep 23, 2022 4:47 am
....
Question:
What will happen if 3 lines cross at the same point? ie existing geometry.

SteveN
Hi Steven,

Please refer this:

Code: Select all

(defun c:Trim3( / pt1 pt2 pt3 pt4 line1 line2)
  (setq pt0 (list 0 0)
	pt1 (list 10 5)	pt2 (list 10 10) pt3 (list 5 10)	
	pt4 (list 10 0) pt5 (list 0 10) )


  (setq line1 (entmakex (list (cons 0 "LINE") (cons 10 pt0) (cons 11 pt1))))

  (setq line2 (entmakex (list (cons 0 "LINE") (cons 10 pt0) (cons 11 pt2))))
  
  (setq line3 (entmakex (list (cons 0 "LINE") (cons 10 pt0) (cons 11 pt3))))

  (setq line4 (entmakex (list (cons 0 "LINE") (cons 10 pt4) (cons 11 pt5))))

  (command "trim" line4 line1 "" pt0 "")
  (command "trim" line4 line2 "" pt0 "")
  (command "trim" line4 line3 "" pt0 "")
  
  (princ)
  )