JONI Posted May 13, 2009 Posted May 13, 2009 Hi I’m busy to convert True-Type font to outline vector I have found the express tool TXTEXP.LSP and it is working well, but it is depending on the zoom factor circumstances After using TXTEXP there are generated many lines in the inner parts of font-outline Using the normal explode command breaks up the font outline and can clean up Using the express tool OVERKILL I can get writ of exactly half of the unneeded lines. The lines I want to delete seem to equal and on top of eachother My first thought is to create a second version of the routine OVERKILL, but looking at the LISP code I must admit its to difficult for me Is there someone who is able to adapt the OVERKILL routine to delete the double line and the original line ass well JONI Quote
Freerefill Posted May 13, 2009 Posted May 13, 2009 Not sure about adapting the OVERKILL routine... I exploded some text to re-create your problem, and I realize what you're attempting. My initial thoughts revolve around taking each member of a selection set and comparing it to each other member, to see if certain elements are the same. If so, delete both members. Seems inefficient, though.. I wonder if there's a better way... Quote
The Buzzard Posted May 13, 2009 Posted May 13, 2009 Please excuse me, I have Express tools. What is the Overkill routine. I do not see it or heard of it. Quote
Freerefill Posted May 13, 2009 Posted May 13, 2009 Try this.. I keep getting an error, but it keeps working.. (defun c:des( / ss count1 count2 chkEnt chk1 chk2 chkNth) (setq ss (ssget (list (cons 0 "LINE")))) (setq count1 0) (setq count2 0) (repeat (sslength ss) (setq chkEnt (ssname ss count1)) (setq chk1 (cdr (assoc 10 (entget chkEnt)))) (setq chk2 (cdr (assoc 11 (entget chkEnt)))) (setq count2 0) (while (ssname ss count2) (setq chkNth (entget (ssname ss count2))) (if (and (equal chk1 (cdr (assoc 11 chkNth))) (equal chk2 (cdr (assoc 10 chkNth))) (not (equal (assoc -1 (entget chkEnt)) (assoc -1 chkNth))) ) (progn (command "erase" chkEnt (ssname ss count2) "") (setq ss (ssdel (ssname ss count2) (ssdel chkEnt ss))) ) ) (setq count2 (1+ count2)) ) (setq count1 (1+ count1)) ) (princ) ) To use it, type the command and you'll be asked to window the selection. Make sure you've already exploded all of it into lines, otherwise you won't get anything. Also, it may lag your system if you have an awful lot of text.. just to warn you ^^' Let me know how it works~ EDIT: My error is in the line with the (ssdel). Figures, first time I tried using it. Oh well. It works regardless. Oh, and for a fun time, try text exploding with a Wingdings font. Pretty cool stuff. ^^ Quote
JONI Posted May 13, 2009 Author Posted May 13, 2009 Please excuse me, I have Express tools. What is the Overkill routine. I do not see it or heard of it. Hi on my PC it is located in the expresstools directory C:\Program Files\AutoCAD 2007\Express\overkill.lsp beneath I made a copy of header of the lisp file Joni ;; ;; OverkillSup.lsp ;; ;; ;; Copyright © 1999 by Autodesk, Inc. ;; ;; Your use of this software is governed by the terms and conditions ;; of the License Agreement you accepted prior to installation of this ;; software. Please note that pursuant to the License Agreement for this ;; software, "[c]opying of this computer program or its documentation ;; except as permitted by this License is copyright infringement under ;; the laws of your country. If you copy this computer program without ;; permission of Autodesk, you are violating the law." ;; ;; AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. ;; AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF ;; MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. ;; DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE ;; UNINTERRUPTED OR ERROR FREE. ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; over-kill - delete overlaping and un-needed entities ;; Takes single list of arguments: ;; ss - selection set ;; fuz - for numeric comparisons ;; ignore - (optional) list of group codes specifying which common group codes to ignore ;; when comparing entities. ;; no-plines - (optional) flag - T means do NOT optimize segments within plines. ;; no-partial - (optional) flag - T means do NOT combine parallel segments that partially overlap ;; no-endtoend - (optional) flag - T means do NOT combine parallel segments that are end to end. ;; Quote
JONI Posted May 13, 2009 Author Posted May 13, 2009 Hi i will try this solution tomorrow thanks for this verry quick replay Joni Quote
Lee Mac Posted May 13, 2009 Posted May 13, 2009 I think this would be a better way to shuffle through the set, I dont really like these methods tbh though.. [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:des [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] ss lLst sPt ePt[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-load-com[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] ss [b][color=RED]([/color][/b][b][color=BLUE]ssget[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b][b][color=RED]([/color][/b][b][color=#009900]0[/color][/b] . [b][color=#ff00ff]"LINE"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]progn[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] lLst [b][color=RED]([/color][/b][b][color=BLUE]vl-remove-if[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]listp[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]cadr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]ssnamex[/color][/b] ss[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]while[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cadr[/color][/b] lLst[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] sPt [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]10[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entget[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] lLst[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] ePt [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]11[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entget[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] lLst[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]foreach[/color][/b] x [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]entget[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] lLst[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]and[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]equal[/color][/b] sPt [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]11[/color][/b] x[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=#009999]0.0001[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]equal[/color][/b] ePt [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]10[/color][/b] x[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=#009999]0.0001[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entdel[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] lLst[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] lLst [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] lLst[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\n<!> No Lines Selected <!>"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] Quote
JONI Posted May 13, 2009 Author Posted May 13, 2009 Try this.. I keep getting an error, but it keeps working.. (defun c:des( / ss count1 count2 chkEnt chk1 chk2 chkNth) (setq ss (ssget (list (cons 0 "LINE")))) (setq count1 0) (setq count2 0) (repeat (sslength ss) (setq chkEnt (ssname ss count1)) (setq chk1 (cdr (assoc 10 (entget chkEnt)))) (setq chk2 (cdr (assoc 11 (entget chkEnt)))) (setq count2 0) (while (ssname ss count2) (setq chkNth (entget (ssname ss count2))) (if (and (equal chk1 (cdr (assoc 11 chkNth))) (equal chk2 (cdr (assoc 10 chkNth))) (not (equal (assoc -1 (entget chkEnt)) (assoc -1 chkNth))) ) (progn (command "erase" chkEnt (ssname ss count2) "") (setq ss (ssdel (ssname ss count2) (ssdel chkEnt ss))) ) ) (setq count2 (1+ count2)) ) (setq count1 (1+ count1)) ) (princ) ) To use it, type the command and you'll be asked to window the selection. Make sure you've already exploded all of it into lines, otherwise you won't get anything. Also, it may lag your system if you have an awful lot of text.. just to warn you ^^' Let me know how it works~ EDIT: My error is in the line with the (ssdel). Figures, first time I tried using it. Oh well. It works regardless. Oh, and for a fun time, try text exploding with a Wingdings font. Pretty cool stuff. ^^ Hi , of course I could not wait until tomorrow and tried it emediatly and its doing exactly what I wanted it to do, a bit slow but it is working. After completion of the routine i applied PEDIT Multiline Join and combined all the remainig line peaces to an complet outline charater In wonder why there is no standard routine to do this annyway Im verry happy concerning your soluting What im trying to get is the folowing sequense in one lisp routine BURST ALL (transfer all the atributes from blocks into tekst) TXTEXP ALL (transfer all text into outline) EXPLODE ALL (breaking up all the entities in the drawing) DES (your lisp routine, deleting all double lines) PEDIT (M)ultiline ALL Y Join combining all lines together forming seperat charakters. So if you are still in the mood but I'm allready happy JONI Quote
Lee Mac Posted May 13, 2009 Posted May 13, 2009 Not sure if this helps? (defun des (/ ss lLst sPt ePt) (vl-load-com) (if (setq ss (ssget "_X" '((0 . "LINE")))) (progn (setq lLst (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))) (while (cadr lLst) (setq sPt (cdr (assoc 10 (entget (car lLst)))) ePt (cdr (assoc 11 (entget (car lLst))))) (foreach x (mapcar 'entget (cdr lLst)) (and (equal sPt (cdr (assoc 11 x)) 0.0001) (equal ePt (cdr (assoc 10 x)) 0.0001) (entdel (car lLst)))) (setq lLst (cdr lLst)))) (princ "\n<!> No Lines Found <!>")) (princ)) (defun c:joni (/ mss pss) (vl-load-com) (and (getvar "PEDITACCEPT") (setvar "PEDITACCEPT" 1)) (if (setq mss (ssget "_X")) (progn (foreach x (mapcar 'vlax-ename->vla-object (mapcar 'cadr (ssnamex mss))) (vl-catch-all-apply 'vla-explode (list x))) (des) (if (setq pss (ssget "_X" '((0 . "LINE,ARC")))) (command "_pedit" "_M" pss "" "_J" "" ""))) (princ "\n<!> Nothing Found <!>")) (princ)) You will need to do the BURST'ing and TXTEXP'ing, but the rest is done NOTE: This will explode everything in the drawing as requested. Quote
The Buzzard Posted May 13, 2009 Posted May 13, 2009 Hi on my PC it is located in the expresstools directory C:\Program Files\AutoCAD 2007\Express\overkill.lsp beneath I made a copy of header of the lisp file Thank you Joni for that information, However I have 2004 & 2009 and its not available in those versions. But again Thank You. Quote
The Buzzard Posted May 13, 2009 Posted May 13, 2009 I see it listed in the express tools help under command line only, But seem to be missing in my menu. I will nee to look into this. Quote
Lee Mac Posted May 13, 2009 Posted May 13, 2009 No, I don't think so (unless you have redefined it). It is found: C:\Program Files\AutoCAD 2004\Express There are two .lsp's Overkill.lsp and Overkillsup.lsp Quote
The Buzzard Posted May 13, 2009 Posted May 13, 2009 I see now. It operates from the command line only. It does not appear int the menu. There are several other commands in there I was not aware of. Good to know, Thanks Quote
Lee Mac Posted May 13, 2009 Posted May 13, 2009 Take a look at the Express tools help file and you will see all the express tools listed... quite a few.. Quote
The Buzzard Posted May 13, 2009 Posted May 13, 2009 Saw that. Just that the program I mentioned says command line only. Did not know that so much more was available. There appears to be some of the oldies I have not seen in a while from previous versions. Quote
JONI Posted May 14, 2009 Author Posted May 14, 2009 Not sure if this helps? (defun des (/ ss lLst sPt ePt) (vl-load-com) (if (setq ss (ssget "_X" '((0 . "LINE")))) (progn (setq lLst (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))) (while (cadr lLst) (setq sPt (cdr (assoc 10 (entget (car lLst)))) ePt (cdr (assoc 11 (entget (car lLst))))) (foreach x (mapcar 'entget (cdr lLst)) (and (equal sPt (cdr (assoc 11 x)) 0.0001) (equal ePt (cdr (assoc 10 x)) 0.0001) (entdel (car lLst)))) (setq lLst (cdr lLst)))) (princ "\n<!> No Lines Found <!>")) (princ)) (defun c:joni (/ mss pss) (vl-load-com) (and (getvar "PEDITACCEPT") (setvar "PEDITACCEPT" 1)) (if (setq mss (ssget "_X")) (progn (foreach x (mapcar 'vlax-ename->vla-object (mapcar 'cadr (ssnamex mss))) (vl-catch-all-apply 'vla-explode (list x))) (des) (if (setq pss (ssget "_X" '((0 . "LINE,ARC")))) (command "_pedit" "_M" pss "" "_J" "" ""))) (princ "\n<!> Nothing Found <!>")) (princ)) You will need to do the BURST'ing and TXTEXP'ing, but the rest is done NOTE: This will explode everything in the drawing as requested. May be I do somting wrong but after loading this code the command des nor joni is responding Quote
eldon Posted May 14, 2009 Posted May 14, 2009 It operates from the command line only. It does not appear int the menu. It does not appear in the menu as Overkill, but as "Delete duplicate objects". When you click on this, the command line says "Overkill". Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.