teknomatika Posted June 13, 2013 Share Posted June 13, 2013 Does anyone know and can indicate some routine that allows, in a selection of text, to filter/separate the letters/numbers? Quote Link to comment Share on other sites More sharing options...
ReMark Posted June 13, 2013 Share Posted June 13, 2013 What exactly are you attempting to do? Please provide an example. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 13, 2013 Share Posted June 13, 2013 Here is my function: [color=GREEN];; Split String - Lee Mac[/color] [color=GREEN];; Splits a string into a list of text and numbers[/color] ([color=BLUE]defun[/color] LM:splitstring ( str ) ( ([color=BLUE]lambda[/color] ( l ) ([color=BLUE]read[/color] ([color=BLUE]strcat[/color] [color=MAROON]"("[/color] ([color=BLUE]vl-list->string[/color] ([color=BLUE]apply[/color] '[color=BLUE]append[/color] ([color=BLUE]mapcar[/color] ([color=BLUE]function[/color] ([color=BLUE]lambda[/color] ( a b c ) ([color=BLUE]cond[/color] ( ([color=BLUE]=[/color] 92 b) ([color=BLUE]list[/color] 32 34 92 b 34 32) ) ( ([color=BLUE]or[/color] ([color=BLUE]<[/color] 47 b 58) ([color=BLUE]and[/color] ([color=BLUE]=[/color] 45 b) ([color=BLUE]<[/color] 47 c 58) ([color=BLUE]not[/color] ([color=BLUE]<[/color] 47 a 58))) ([color=BLUE]and[/color] ([color=BLUE]=[/color] 46 b) ([color=BLUE]<[/color] 47 a 58) ([color=BLUE]<[/color] 47 c 58)) ) ([color=BLUE]list[/color] b) ) ( ([color=BLUE]list[/color] 32 34 b 34 32)) ) ) ) ([color=BLUE]cons[/color] [color=BLUE]nil[/color] l) l ([color=BLUE]append[/color] ([color=BLUE]cdr[/color] l) '(( ))) ) ) ) [color=MAROON]")"[/color] ) ) ) ([color=BLUE]vl-string->list[/color] str) ) ) _$ (LM:splitstring "ab12c-3.1de4.2f56") ("a" "b" 12 "c" -3.1 "d" "e" 4.2 "f" 56) Quote Link to comment Share on other sites More sharing options...
teknomatika Posted June 13, 2013 Author Share Posted June 13, 2013 What exactly are you attempting to do? Please provide an example. ReMark, I appreciate your interest. In particular, selecting a set of texts, I intend to separate/ filter letters/numbers. I want this filtering to then be able to manipulate their selection, including separate into layers. Attached a picture. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 13, 2013 Share Posted June 13, 2013 Ah - I see that I misunderstood your question. See this post: http://www.theswamp.org/index.php?topic=35485.msg407075#msg407075 Quote Link to comment Share on other sites More sharing options...
teknomatika Posted June 14, 2013 Author Share Posted June 14, 2013 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun kg:SsgetFilterReal () '( (1 . "~*[~-.0-9]*") ; only minus signs, decimal points and numbers allowed (1 . "*`.*") ; there must be one decimal point (1 . "~*`.*`.*") ; only one decimal point allowed (-4 . "<OR") (1 . "~*-*") ; there is no minus sign (-4 . "<AND") (1 . "-*") ; the minus sign must be the first character (1 . "~*-*-*") ; only one minus sign allowed (-4 . "AND>") (-4 . "OR>") ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun c:Comp (/ ent ss i lst) (if (and (setq ent (entsel "\nPlease select a text for style, layer and text height filtering: ")) (setq ent (entget (car ent))) (or (equal '(0 . "TEXT") (assoc 0 ent)) (prompt "\nNot a text ") ) (or (setq ss (ssget "_X" (vl-list* '(0 . "TEXT") (assoc 7 ent) ; style of digit text (assoc 8 ent) ; selected layer name (assoc 40 ent) ; selected text height (assoc 410 ent) ; current tab only ;; numerical text filtering: (kg:SsgetFilterReal) ) ) ) (prompt "\nNo selection ") ) ) (mapcar '(lambda (a) (cdr (assoc 1 (entget a)))) (repeat (setq i (sslength ss)) (setq lst (cons (ssname ss (setq i (1- i))) lst)) ) ) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ah - I see that I misunderstood your question. See this post: http://www.theswamp.org/index.php?topic=35485.msg407075#msg407075 Lee, I appreciate the attention. I've been checking. From what I can understand and test, the routine can check and filter integers and real numbers in different steps. However, I intended for scanning to be simultaneously isolating all the numbers of letters, or vice versa. It is also critical that the result of the filtering is available in a selection to be able to assign a specific layer. Quote Link to comment Share on other sites More sharing options...
pBe Posted June 14, 2013 Share Posted June 14, 2013 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun c:Comp (/ ent ss i lst) (if (and (setq ent (entsel "\nPlease select a text for style, layer and text height filtering: ")) (setq ent (entget (car ent))) ..... I don't get it teknomatika, what are you targeting? Quote Link to comment Share on other sites More sharing options...
teknomatika Posted June 14, 2013 Author Share Posted June 14, 2013 I don't get it teknomatika, what are you targeting? pBe, This is part of the code referenced by lee mac. From what I could try, as I explained, it can filter at different steps, integers and real but only displays the result in the prompt. I intend that the filtering simultaneously and which is the result of a selection becomes available, allowing the manipulation / editing, such as assigning a specific layer. In summary, the proposed target is to separate / isolate letters / numbers (real or integer) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 14, 2013 Share Posted June 14, 2013 From what I can understand and test, the routine can check and filter integers and real numbers in different steps. However, I intended for scanning to be simultaneously isolating all the numbers of letters, or vice versa.It is also critical that the result of the filtering is available in a selection to be able to assign a specific layer. The link I provided is not a ready-made solution for you to copy/paste for your task; I am simply pointing you in the right direction and providing the tools to help you to write your own program. Quote Link to comment Share on other sites More sharing options...
teknomatika Posted June 14, 2013 Author Share Posted June 14, 2013 The link I provided is not a ready-made solution for you to copy/paste for your task; I am simply pointing you in the right direction and providing the tools to help you to write your own program. Yes, of course. Quote Link to comment Share on other sites More sharing options...
teknomatika Posted June 14, 2013 Author Share Posted June 14, 2013 Well, for now this solution will help me. Not exactly the solution you want, because the filter must include all entities text, even if with different properties (style, layer, color, height, etc..). ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;by:roy_043 ;; http://www.theswamp.org/index.php?topic=35485.msg407075#msg407075 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun kg:SsgetFilterNum () '( (1 . "~*[~-.0-9]*") ; only minus signs, decimal points and numbers allowed (1 . "~*`.*`.*") ; only one decimal point allowed (-4 . "<OR") (1 . "~*-*") ; there is no minus sign (-4 . "<AND") (1 . "-*") ; the minus sign must be the first character (1 . "~*-*-*") ; only one minus sign allowed (-4 . "AND>") (-4 . "OR>") ) ) (defun kg:SsgetFilterInt () '( (1 . "~*[~-0-9]*") ; only minus signs and numbers allowed (-4 . "<OR") (1 . "~*-*") ; there is no minus sign (-4 . "<AND") (1 . "-*") ; the minus sign must be the first character (1 . "~*-*-*") ; only one minus sign allowed (-4 . "AND>") (-4 . "OR>") ) ) (defun kg:SsgetFilterReal () '( (1 . "~*[~-.0-9]*") ; only minus signs, decimal points and numbers allowed (1 . "*`.*") ; there must be one decimal point (1 . "~*`.*`.*") ; only one decimal point allowed (-4 . "<OR") (1 . "~*-*") ; there is no minus sign (-4 . "<AND") (1 . "-*") ; the minus sign must be the first character (1 . "~*-*-*") ; only one minus sign allowed (-4 . "AND>") (-4 . "OR>") ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun FilterNum (/ ent ss i lst) (if (and (setq ent (entsel "\nPlease select a text for style, layer and text height filtering: ")) (setq ent (entget (car ent))) (or (equal '(0 . "TEXT") (assoc 0 ent)) (prompt "\nNot a text ") ) (or (setq ss (sssetfirst nil (ssget "_X" (vl-list* '(0 . "TEXT") (assoc 7 ent) ; style of digit text (assoc 8 ent) ; selected layer name (assoc 40 ent) ; selected text height (assoc 410 ent) ; current tab only ;; numerical text filtering: (kg:SsgetFilterNum) ) ) ) ) (prompt "\nNo selection ") ) ) (mapcar '(lambda (a) (cdr (assoc 1 (entget a)))) (repeat (setq i (sslength ss)) (setq lst (cons (ssname ss (setq i (1- i))) lst)) ) ) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun FilterReal (/ ent ss i lst) (if (and (setq ent (entsel "\nPlease select a text for style, layer and text height filtering: ")) (setq ent (entget (car ent))) (or (equal '(0 . "TEXT") (assoc 0 ent)) (prompt "\nNot a text ") ) (or (setq ss (sssetfirst nil (ssget "_X" (vl-list* '(0 . "TEXT") (assoc 7 ent) ; style of digit text (assoc 8 ent) ; selected layer name (assoc 40 ent) ; selected text height (assoc 410 ent) ; current tab only ;; numerical text filtering: (kg:SsgetFilterReal) ) ) ) ) (prompt "\nNo selection ") ) ) (mapcar '(lambda (a) (cdr (assoc 1 (entget a)))) (repeat (setq i (sslength ss)) (setq lst (cons (ssname ss (setq i (1- i))) lst)) ) ) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun FilterInt (/ ent ss i lst) (if (and (setq ent (entsel "\nPlease select a text for style, layer and text height filtering: ")) (setq ent (entget (car ent))) (or (equal '(0 . "TEXT") (assoc 0 ent)) (prompt "\nNot a text ") ) (or (setq ss (sssetfirst nil (ssget "_X" (vl-list* '(0 . "TEXT") (assoc 7 ent) ; style of digit text (assoc 8 ent) ; selected layer name (assoc 40 ent) ; selected text height (assoc 410 ent) ; current tab only ;; numerical text filtering: (kg:SsgetFilterInt) ) ) ) ) (prompt "\nNo selection ") ) ) (mapcar '(lambda (a) (cdr (assoc 1 (entget a)))) (repeat (setq i (sslength ss)) (setq lst (cons (ssname ss (setq i (1- i))) lst)) ) ) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun c:FILTEXT (/ gets) (initget 1 "N I R") (setq gets (getkword "\nFilter Mode: (N)umeric; (I)inters; (R)eal; : ")) (cond ((= gets "N") (FilterNum) ) ((= gets "I") (FilterInt) ) ((= gets "R") (FilterReal) ) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Quote Link to comment Share on other sites More sharing options...
pBe Posted June 14, 2013 Share Posted June 14, 2013 (repeat (setq i (sslength [b][color=blue](setq ss (cadr ss))[/color][/b])) (setq lst (cons (ssname ss (setq i (1- i))) lst)) ) And you can easily achieved this by using a lot less filter for DXF 1 [me thinks/ less codes that is]. but then again, I'm not sure unless we see what are the "other" conditions. I'm just saying Quote Link to comment Share on other sites More sharing options...
teknomatika Posted June 17, 2013 Author Share Posted June 17, 2013 pBe, Thanks for your attention. Quote Link to comment Share on other sites More sharing options...
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.