RepCad Posted March 26, 2020 Posted March 26, 2020 (edited) Hello every one, I wrote this code to ssget all text : (setq ss1 (ssget '((0 . "text,mtext")))) Is it possible to ssget all texts except a specific text string in above code? for example get all text except "Screw" Edited March 26, 2020 by amir0914 Quote
Tharwat Posted March 26, 2020 Posted March 26, 2020 What do you mean by 'text name' ? is it text style or text string ? 1 Quote
Tharwat Posted March 26, 2020 Posted March 26, 2020 (setq ss1 (ssget '((0 . "text,mtext") (-4 . "<NOT") (1 . "Screw") (-4 . "NOT>") ) ) ) 2 Quote
RepCad Posted March 26, 2020 Author Posted March 26, 2020 4 minutes ago, Tharwat said: (setq ss1 (ssget '((0 . "text,mtext") (-4 . "<NOT") (1 . "Screw") (-4 . "NOT>") ) ) ) Thank you Tharwat, is it possible to do this with multiple text string name or list of string name? for example: list = ("Screw","Hole","pin") I mean ssget all texts except items of list Quote
Tharwat Posted March 27, 2020 Posted March 27, 2020 11 hours ago, amir0914 said: Thank you Tharwat, is it possible to do this with multiple text string name or list of string name? for example: list = ("Screw","Hole","pin") I mean ssget all texts except items of list Example: (setq lst '("Screw" "Hole" "pin")) (setq ss1 (ssget (append '((0 . "text,mtext") (-4 . "<NOT") (-4 . "<OR")) (mapcar '(lambda (u) (cons 1 u)) lst) '((-4 . "OR>") (-4 . "NOT>")) ) ) ) 1 Quote
RepCad Posted March 27, 2020 Author Posted March 27, 2020 Many thanks for your consideration, I have another request, is it possible to select items of lst by ssget ? Quote
Tharwat Posted March 27, 2020 Posted March 27, 2020 2 hours ago, amir0914 said: Many thanks for your consideration, I have another request, is it possible to select items of lst by ssget ? You're welcome anytime. (setq lst '("Screw" "Hole" "pin")) (setq ss1 (ssget (append '((0 . "text,mtext")) (list (cons 1 (apply 'strcat (mapcar '(lambda (u) (strcat u ",")) lst)))) ) ) ) 1 Quote
ronjonp Posted March 27, 2020 Posted March 27, 2020 8 hours ago, Tharwat said: Example: (setq lst '("Screw" "Hole" "pin")) (setq ss1 (ssget (append '((0 . "text,mtext") (-4 . "<NOT") (-4 . "<OR")) (mapcar '(lambda (u) (cons 1 u)) lst) '((-4 . "OR>") (-4 . "NOT>")) ) ) ) Quick test and this works too (case sensitive of course). (setq ss1 (ssget (append '((0 . "text,mtext")) (mapcar '(lambda (u) (cons 1 (strcat "~" u))) '("Screw" "Hole" "pin")) ) ) ) 1 Quote
RepCad Posted March 28, 2020 Author Posted March 28, 2020 Many thanks to Tharwat and ronjonp. 1 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.