Lisp trim

Lisp trim

manasi4532
Enthusiast Enthusiast
1,148 Views
8 Replies
Message 1 of 9

Lisp trim

manasi4532
Enthusiast
Enthusiast

I'm looking for a lisp for auto trim to trim small gaps between squares

 I have attached an example for your understanding.

The distance between the gaps is 0.1mm, the same for all gaps. The distance between the gaps is 0.1 mm, the same for all gaps.

 

Thank you

0 Likes
Accepted solutions (1)
1,149 Views
8 Replies
Replies (8)
Message 2 of 9

Sea-Haven
Mentor
Mentor
Accepted solution

I think your before and after are the same, I take it the squares are full length horizontal and vertical lines drawn with 0.1 gap.

 

So try this, written for some one else so meets their criteria, just edit to suit.

 

 

; Break all beams 
; Breakall by CAB much appreciated

(defun c:Breakbeams ( /  ss ent obj )

(if (not breakall)(load "Breakall"))

;(Break_all ss ss nil)
(c:breakall)
(princ "\n")
(prompt "Select short lengths ")
(setq ss (ssget (list (cons 0 "*LINE,ARC"))))
(repeat (setq x (sslength ss))
(setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
(if (= (vlax-get obj 'Objectname) "AcDbArc")
(setq length (vlax-get obj 'ARCLENGTH))
(setq length (vlax-get obj 'LENGTH))
)
(if (< length 0.15)
(vla-delete obj)
)
)
(command "regen")
(princ)
)

 

 Thanks to CAB for break all. 

0 Likes
Message 3 of 9

manasi4532
Enthusiast
Enthusiast

Sry I run in Autocad LT2024 the command mannotify it notifies error bad argunent type:lselsetp nil.

0 Likes
Message 4 of 9

Sea-Haven
Mentor
Mentor

Please try these steps, just type the code lines 1 at a time to the command line.

 

(load "breakall")

Breakall

 

Then select all line work, let me know if it works. This should make little 0.1 lines.

 

Post a correct before dwg.

 

Message 5 of 9

Kent1Cooper
Consultant
Consultant

@Sea-Haven wrote:

I think your before and after are the same, 


No, they're not:

Kent1Cooper_0-1709070673000.png

The squares are not what they want Trimmed, but the white Polylines, between the closer edges of squares.

 

@manasi4532 , the thing I'm having a hard time imagining how to accomplish is to distinguish the details of the circumstances at all locations so that it gets the "after" result above, rather than this:

Kent1Cooper_0-1709070959186.png

Kent Cooper, AIA
Message 6 of 9

Sea-Haven
Mentor
Mentor

Was looking in wrong spot, thanks Kent. The breakall by CAB will do what is required it will break all lines, the issue is setting the gap length if shallow angles may be reasonably long compared to say 45 which is 1.414 * gap. 

 

After breakall magenta line is created changed color for image, can then get all lines on that layer and delete those less than 0.101

SeaHaven_0-1709073124083.png

 

In code above layer should be "0"

 

0 Likes
Message 7 of 9

manasi4532
Enthusiast
Enthusiast

1709083867535.jpgThank you for this help. But it still has some problems. I repeat the command again. It can solve the problem.😍

0 Likes
Message 8 of 9

manasi4532
Enthusiast
Enthusiast

Thank you for this help. 

0 Likes
Message 9 of 9

Sea-Haven
Mentor
Mentor

Fixed the ssget was looking for Lines only but you have Plines, breakall keeps object type for Plines, Circles get new arcs.

 

SeaHaven_0-1709162131769.png

Updated code above. Increased max size may need a tweak once used on a few dwg's, added Arc's & Plines.

0 Likes