GLORY Posted March 26, 2021 Posted March 26, 2021 (edited) Hello everyone i have this code that im working for sometime... (while (not (setq ent (car (entsel "\nSelect rectangle: "))))) What i want is to change the selection option into ssget with layer filter, so that i would not pick the rectangle one by one and will do the same routine for every rectangle in the selection set. Edited March 26, 2021 by GLORY Quote
Tharwat Posted March 26, 2021 Posted March 26, 2021 Hi, Rectify the layer name "MyLayer" in the following codes to suit yours. (ssget '((0 . "*POLYLINE") (8 . "MyLayer") (-4 . "<AND") (-4 . "&=") (70 . 1) (-4 . "AND>"))) 1 Quote
GLORY Posted March 26, 2021 Author Posted March 26, 2021 What i did is... (while (not (setq en (car (ssget '((0 . "*POLYLINE") (8 . "DWG_SHEET") (-4 . "<AND") (-4 . "&=") (70 . 1) (-4 . "AND>"))))))) But the routine after that condition is not running, or should i specify the counter also? Quote
Tharwat Posted March 26, 2021 Posted March 26, 2021 Its not like that. The codes that I posted allow the user to select as many as they want then you need after that to iterate the selection set and do your stuff at each entity object. e.g: (if (setq ss (ssget '((0 . "*POLYLINE") (8 . "DWG_SHEET") (-4 . "<AND") (-4 . "&=") (70 . 1) (-4 . "AND>")))) (repeat (setq i (sslength ss)) (setq ent (ssname ss (setq i (1- i)))) ;; one entity which is eaual to single selection like, (car (entsel "\nSelect object :")) ;; do your stuff here .... ) ) 2 Quote
GLORY Posted March 26, 2021 Author Posted March 26, 2021 Thank you so much Tharwat, now it works perfectly. Quote
GLORY Posted March 26, 2021 Author Posted March 26, 2021 One more thing, i had this in mind to trim lines in specific layer automatically is possible, given say for example dwg_sheet layer as the trim boundary? Quote
Tharwat Posted March 26, 2021 Posted March 26, 2021 Yes that is possible and it depends on your requirements in this case since the required codes for this task would be much, so search the forum for your key word like trim , trimming ... or so. Good luck. Quote
BIGAL Posted March 27, 2021 Posted March 27, 2021 (edited) If interpret correct "dwg_sheet layer as the trim boundary" is this not what a layout and a viewport would do ? Try Cookiecutter2.lsp or Extrim, Express option can be programmed to trim objects automatically. Edited March 27, 2021 by BIGAL Quote
Lee Mac Posted March 30, 2021 Posted March 30, 2021 On 3/26/2021 at 3:06 PM, Tharwat said: Rectify the layer name "MyLayer" in the following codes to suit yours. (ssget '((0 . "*POLYLINE") (8 . "MyLayer") (-4 . "<AND") (-4 . "&=") (70 . 1) (-4 . "AND>"))) For what it's worth, the (-4 . "<AND") (-4 . "AND>") logical operators are not actually required here, as the ssget filter list has an implicit AND logic. Quote
islasi Posted October 7, 2022 Posted October 7, 2022 What is this for? (-4 . "<AND") (-4 . "&=") (70 . 1) (-4 . "AND>")) Quote
Jonathan Handojo Posted October 7, 2022 Posted October 7, 2022 10 hours ago, islasi said: What is this for? (-4 . "<AND") (-4 . "&=") (70 . 1) (-4 . "AND>")) For a polyline, it will only select those that are closed. (More technically, selects the polyline whose "Closed" property is set to "Yes"). 2 Quote
mhupp Posted October 7, 2022 Posted October 7, 2022 (edited) @islasi more info closer to the bottom of the page under "Logical Operators" http://www.lee-mac.com/ssget.html Here is a better example. This will select any polyline on Mylayer that is either color red or white. (ssget '((0 . "*POLYLINE") (8 . "MyLayer") (-4 . "<OR") (62 . 1) (62 . 7) (-4 . "OR>"))) So its like two ssget's in one (ssget '((0 . "*POLYLINE") (8 . "MyLayer") (62 . 1))) (ssget '((0 . "*POLYLINE") (8 . "MyLayer") (62 . 7))) This isn't needed for dotted pairs with strings as you can search multiple criteria with a " , " (ssget '((0 . "*POLYLINE,CIRCLE") (8 . "MyLayer1,MyLayer2,MyLayer3") (62 . 7))) Select any polyline or circle that are on MyLayer1 - 3 that is color white Edited October 7, 2022 by mhupp 1 Quote
Steven P Posted October 7, 2022 Posted October 7, 2022 From the SSGET examples, I look at it that anything within a pair of brackets is OR, and different sets of brackets is AND for the selection: Select (Polyline OR Circle) AND (MyLayer1 OR MyLayer2 OR MyLayer3) AND ((colour) 7) I'll have to remember the polyline code 70, am sure it came up the other day in something I was doing. Quote
Jonathan Handojo Posted October 7, 2022 Posted October 7, 2022 7 hours ago, Steven P said: From the SSGET examples, I look at it that anything within a pair of brackets is OR, and different sets of brackets is AND for the selection: There are four logical operators: AND, OR, NOT, XOR. Like you said, anything not being enclosed (or the outermost part of any nested expressions which you call "brackets") is treated using the AND operator, and any others is just as how the expressions detail it. More details on this here. 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.