lisp for combine trim and extend command

lisp for combine trim and extend command

miroslav.pristov
Advocate Advocate
5,725 Views
14 Replies
Message 1 of 15

lisp for combine trim and extend command

miroslav.pristov
Advocate
Advocate

Hello all,

 

I apologize if there is similar post in this forum but i cant found it.

 

Often I have a problem like on the attached picture.  To get drawing B from drawing A i must use trim and extend functions on lines with two parts (magenta yelow lines) or on single lines (blue ones). One part of line i must trim on white line and other part i must extend to white line. Single lines i must only extend or trim. If I only have one line, or one line with two parts that is not such a problem. However, if there are more of them it can be quite boring.

 

is there a chance someone to make me lisp like this:

 

1. to choose white line first.

2. to choose all other colored lines

 

After that the lisp command will make drawing B from drawing A. 

 

This is just a sample. The color of lines is not valid in making lisp command.

 

Beside the picture bellow i got file of sample attached too

 

Thank you this will help me a lot and save my time.

 

slika.png

 

 

 

 

0 Likes
Accepted solutions (2)
5,726 Views
14 Replies
Replies (14)
Message 2 of 15

Satoews
Advocate
Advocate
Accepted solution

I am not quite getting what you are asking but I had an issue with trim till I found I could hold down shift while in the command and it turns it into the extend command. Maybe that helps?

Shawn T
Message 3 of 15

ВeekeeCZ
Consultant
Consultant
Accepted solution

Hi, try this. I just found it in my archive... looks good so far.

 

Edit: finally I've found my own version... 

Message 4 of 15

john.uhden
Mentor
Mentor

I see you already have some good solutions from very good people.

 

As an alternative, does this sound like what you want?

 

;; Multiple EXtend TRIM program allows user to select a group of ARCS, LINES,
;; or 2D POLYLINES as boundaries and select a group of LINES to extend or trim.
;; Intersection points are computed and the NEAREST endpoint is modified to the
;; point of intersection. There is no need to know whether each line should be
;; extended or trimmed, therefor eliminating time consuming zooms.

;; The program is written to reset all drawing variables to their initial
;; states. An "UNDO" command will remove all entities created, and restore
;; any deleted.

 

It's already written.  Would just have to remove security to make it freeware.

John F. Uhden

0 Likes
Message 5 of 15

mattcourage
Participant
Participant

I could use this lisp. Is it possible for you to send it to me?

0 Likes
Message 6 of 15

john.uhden
Mentor
Mentor

@mattcourage 

I would be glad to post it, if I could find it.

It's not here at work with me so I hope it's at home.  Will search.

John F. Uhden

0 Likes
Message 7 of 15

john.uhden
Mentor
Mentor

@mattcourage 

I found MEXTRIM.lsp at home.  Just have to redact it.

John F. Uhden

0 Likes
Message 8 of 15

john.uhden
Mentor
Mentor

@mattcourage 

Here ya go.

It's old, and it doesn't seem to be working the way I had thought.

If you have a collection of somewhat parallel lines (to be modified) and then say one arc, one polyline, and one line  (boundaries) near each end of the lines, you can't be sure which of the boundary objects will be the limit of trimming or extending.  But if you have just one boundary object at one or each end, then I think it works as expected.

John F. Uhden

0 Likes
Message 9 of 15

mattcourage
Participant
Participant
Thanks a lot. I’ll give it a try.
Message 10 of 15

Kent1Cooper
Consultant
Consultant

If those magenta and yellow pieces share endpoints without overlapping, you can also do it by grip-editing.  Just have INTersection running Object Snap turned on, grab all the magenta and yellow pieces [or even everything in the area including the white line], pick on a grip where two endpoints meet, and drag it to the INTersection of the white line with whichever of them INTersects it.  That would be faster than using a Trim or Extend command and Shift to toggle, because the latter means doing something with each piece in a pair separately, but by grip-editing you can move the endpoints of both together.

Kent Cooper, AIA
0 Likes
Message 11 of 15

_anonandon
Advocate
Advocate

thanks for the ExtendTrim Mr BeeKee! works for my use but could someone change the way it selects objects please?

 

I'd like to select a handful of lwpolylines, one of them closed, and have all the open polyline extend/trim to the closed one.

 

This selection works on its own but I cant get it to work in BeeKee's ExtendTrim

 

 

;ORIGINAL by Dexus
; throw an error of more than one closed poly selected??

(if (setq ss1 (ssget '((0 . "*LINE")))) (progn
	(setq sx (ssadd) ; Create empty selectionset
	      ss (ssadd) ; Create empty selectionset
	      counter 0)
	(repeat (setq i (sslength ss1)) ; Loop through selectionset and split into two sets
		(setq e (ssname ss1 (setq i (1- i))))
		(if (eq (cdr (assoc 70 (entget e))) 129) ; Decide which set to add to.
			(ssadd e sx)
			(ssadd e ss)
		)
	)
	(setq ss1 nil) ; Remove origional set

 

 

0 Likes
Message 12 of 15

Kent1Cooper
Consultant
Consultant

@_anonandon wrote:

....

I'd like to select a handful of lwpolylines, one of them closed....

....
		(if (eq (cdr (assoc 70 (entget e))) 129) ; Decide which set to add to.
....

Careful -- that test will recognize only closed LWPolylines with linetype generation enabled.  The indicator for being closed is the 1 bit, and for a closed one without linetype generation enabled, that (assoc 70) value will be just 1, not 129.  The additional 128 is the bit indicating that linetype generation is on.

 

This test will recognize that a Polyline is closed, whether or not linetype generation is enabled:

(if (= (logand (cdr (assoc 70 (entget e))) 1) 1)

Kent Cooper, AIA
Message 13 of 15

_anonandon
Advocate
Advocate

thanks, a much better test!

0 Likes
Message 14 of 15

ВeekeeCZ
Consultant
Consultant

@_anonandon wrote:

... I'd like to select a handful of lwpolylines, one of them closed, and have all the open polyline extend/trim to the closed one. ...


 

Possibly like this...

 

Message 15 of 15

_anonandon
Advocate
Advocate

legend!

0 Likes