PDA

View Full Version : trim lisp


youngsoo
2007-10-15, 09:23 AM
Hi everyone!
Look at the attached file.

Could you trim the line like that I showed attached file?

Happy computing!

CAB2k
2007-10-15, 02:00 PM
Have you tried Express Tools btrim?

youngsoo
2007-10-18, 06:23 AM
I could see circle trimed,but couldn't see rectangle trimed.
How can I do?

Please modify.(Is it right expression in English?)


(defun c:autotrim(/ os tr ss k ent ed x40 nen cen x0 lis ss1)

(setq os (getvar "osmode")) ; Get OSnap modes available
(setq tr (getvar "edgemode"))
(setq k 0 lis nil)
(setq ss (ssget (list (cons 0 "insert")))) ;; Group code 0 is the type of entity.
(setq nen (entget (car (nentsel "\nBlock select:"))))
(setq x40 (cdr (assoc 40 nen))
cen (cdr (assoc 10 nen)))
(repeat (sslength ss)
(setq ent (ssname ss k)
ed (entget ent))
(setq x0 (cdr (assoc 0 ed))); Specify the type of selected object
(if (= x0 "INSERT") (setq x10 (cdr (assoc 10 ed))))
(setq lis (append lis (list x10)))
(setq k (1+ k))
);repeat
(setvar "osmode" 0); Deactivate any current OSnap
(setvar "edgemode" 0)
(command "undo" "be")
(setq ss1 (ssadd))


(foreach pt lis (progn (command "circle" pt x40)(setq ss1 (ssadd (entlast) ss1))))


(foreach pt lis (command "trim" ss1 "" pt ""))
(command "erase" ss1 "")
(command "undo" "e")
(setvar "edgemode" tr)
(setvar "osmode" os)

(princ)
)

youngsoo
2007-10-30, 12:25 PM
Could you trim the lines in the blocks automatically?
I just want to make lines between blocks.

mweaver
2007-10-31, 01:15 PM
Could you trim the lines in the blocks automatically?
I just want to make lines between blocks.

How about this approach? No trimming required, no code required. See the attached dwg.

Note the layer color for layer G-Misc-Whit is a true-color white (255,255,255) and has the draworder set behind the rest of the block geometry.

jmctamney
2007-10-31, 03:29 PM
How about this approach? No trimming required, no code required. See the attached dwg.

Note the layer color for layer G-Misc-Whit is a true-color white (255,255,255) and has the draworder set behind the rest of the block geometry.

Novel idea unless his plotter is set for "lines merge" instead of "lines overwrite"