alanjt Posted April 29, 2010 Posted April 29, 2010 Very close... (defun c:hex (/ ss) (if (setq ss (ssget "_:L" '((8 . "3D_HWR")))) ((lambda (i) (while (setq e (ssname ss (setq i (1+ i)))) (command "_.explode" e) ) ) -1 ) ) (princ) ) However, with the explode command, you have to step through the entities. Quote
MikeP Posted April 29, 2010 Author Posted April 29, 2010 guys thanks alot, you have no idea how much time this simple command has saved me. Quote
alanjt Posted April 29, 2010 Posted April 29, 2010 guys thanks alot, you have no idea how much time this simple command has saved me. You're welcome. Quote
VVA Posted October 24, 2011 Posted October 24, 2011 I recommend you select similar Rivilis Alexander. It works great. some reviewers: http://www.theswamp.org/index.php?topic=28032.msg340533#msg340533 The choice of primitives on the model - the team _SelSimThe choice of primitives on the model of the already selected - command _SelSimSel Setting the choice of the model - the command _SelSimOptions Command selection on the model appears in the context menu. Download from here: http://www.maestrogroup.com.ua/support/selsim.zip For AutoCAD 2004-2006: SelSim2006.arx For AutoCAD 2007-2009: SelSim2007.arx For AutoCAD 2010-2012: SelSim2010x32.arx and SelSim2010x64.arx Choosing a primitive (s) and you harvest the right mouse button (or dial _SELSIM the command line). http://www.maestrogroup.com.ua/support/ also recommend that you try geomprops Quote
tpitera Posted September 30, 2020 Posted September 30, 2020 I am trying to use (setq ss (ssget "_:L" '((0 . "POLYLINE"))) in the following code (defun c:TRY() (load "C:/Users/Thomas Pitera/Downloads/20-6249 - CORINNA - URE/SLOPES/Test/LayerIsolateFreezeThaw.lsp") (c:LIT); freezes all layers accept current (command "CreateSurface") (command "AddSurfaceContours" (setq ss (ssget "_:L" '((0 . "POLYLINE")))));meant to get all the contours as input ) any pointers would be appreciated Quote
alanjt Posted October 1, 2020 Posted October 1, 2020 15 hours ago, tpitera said: I am trying to use (setq ss (ssget "_:L" '((0 . "POLYLINE"))) in the following code (defun c:TRY() (load "C:/Users/Thomas Pitera/Downloads/20-6249 - CORINNA - URE/SLOPES/Test/LayerIsolateFreezeThaw.lsp") (c:LIT); freezes all layers accept current (command "CreateSurface") (command "AddSurfaceContours" (setq ss (ssget "_:L" '((0 . "POLYLINE")))));meant to get all the contours as input ) any pointers would be appreciated This should give you something to chew on. (defun c:TRY (/ clayer lst e ss) ;;;(load "C:/Users/Thomas Pitera/Downloads/20-6249 - CORINNA - URE/SLOPES/Test/LayerIsolateFreezeThaw.lsp") ;;;(c:LIT); freezes all layers accept current ;; since i don't have access to your program, i'll just bake my own. ;; no need to freeze layers, turning them off is fine (setq clayer (getvar 'CLAYER)) ; get current layer ;; step through layers and turn off (making a list to turn the layers back on) (vlax-for x (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))) (if (and (eq (vla-get-layeron x) :vlax-true) ; only continues if layer is on (not (eq (vla-get-name x) clayer)) ; only continues if layer isn't current ) (progn (vla-put-layeron x :vlax-false) ; turn layer off (setq lst (cons x lst)) ; create list of layers turned off so you can turn them back on at end ) ) ) (setq e (entlast)) ; last object created in drawing (princ "\nSelect polyline contours to add to surface: ") ; prompt user on what they're selecting (if (and (setq ss (ssget '((0 . "LWPOLYLINE")))) ; create a seletionset of LWPolylines. the "_:L" isn't not required as we don't need to filter out locked layers (progn (command "_.createsurface") ; create the surface (not (equal e (setq e (entlast)))) ; compare last created object (should be your new surface) with one you stored at beginning. if same, you did not create a surface and the command cancels, otherwise it continues ) ) (progn (sssetfirst nil ss) ; selects the polylines (mimicking a pickfirst selection) to remove the need to within the command (command "_.addsurfacecontours" e) ; execute add contours command. the 'e' is where we stored the newly created surface when we checked to make sure it had been created (saves us having to specify it again) ) ) (foreach x lst (vla-put-layeron x :vlax-true)) ; command is finished. time to turn the layers back on (princ) ) (vl-load-com) (princ) Quote
ronjonp Posted October 1, 2020 Posted October 1, 2020 (edited) @alanjt You're posting again Alan! Nice to see you around Edited October 1, 2020 by ronjonp 1 Quote
alanjt Posted October 1, 2020 Posted October 1, 2020 1 hour ago, ronjonp said: @alanjt You're posting again Alan! Nice to see you around Thank you! 1 Quote
stlo Posted July 19, 2022 Posted July 19, 2022 Hi everyone! I was exactly looking for something similar to what MikeP asked for! Is there a way to select more than one color at the time! I would like to select only Lines with color 0, 7 and 256 and switch them on the layer EASED. I don't know a lot about Lisp and I've tried some stuff but I'm stuck! Thanks for your help! (defun c:test (/ ss) (if (setq ss (ssget "_:L" '((0 . "LINE") (62 . 0)))) ;;;How do I add the color 7 and the color 256 from here??? ;;; (command "CHANGE" (entlast) "" "P" "LA" "EASED" "") ) (princ) ) Quote
ronjonp Posted July 19, 2022 Posted July 19, 2022 Try something like this: (setq ss (ssget "_:L" '((0 . "LINE") (-4 . "<OR") (62 . 0) (62 . 7) (62 . 256) (-4 . "OR>")))) 1 Quote
stlo Posted July 19, 2022 Posted July 19, 2022 Hi ronjonp! Thanks for helping! It's not working, nothing is selected! Can I replace the OR by AND? I'm curious, What means the -4? Thanks! Quote
stlo Posted July 19, 2022 Posted July 19, 2022 I see that some objects are selected but none of them are highlighted so I can't apply any changes to them? Quote
stlo Posted July 19, 2022 Posted July 19, 2022 I understood my mistake! It was the code on my first post! Thanks ronjonp! This is exactly what I was looking for! Here's the final lisp if it can be useful for someone else! Have a good day! (defun c:test (/ ss) if (setq ss (ssget "_:L" '((0 . "LINE") (-4 . "<OR") (62 . 0) (62 . 7) (62 . 256) (-4 . "OR>")))) (command "_.change" ss "" "P" "LA" "EASED" "") (princ) ) Quote
ronjonp Posted July 19, 2022 Posted July 19, 2022 1 hour ago, stlo said: I understood my mistake! It was the code on my first post! Thanks ronjonp! This is exactly what I was looking for! Here's the final lisp if it can be useful for someone else! Have a good day! (defun c:test (/ ss) if (setq ss (ssget "_:L" '((0 . "LINE") (-4 . "<OR") (62 . 0) (62 . 7) (62 . 256) (-4 . "OR>")))) (command "_.change" ss "" "P" "LA" "EASED" "") (princ) ) Glad to help Quote
mhupp Posted July 19, 2022 Posted July 19, 2022 1 hour ago, stlo said: Can I replace the OR by AND? I'm curious, What means the -4? "and" is used when you want to have multiple checks on an entity. Like a red line "and" its on layer 0. So all "and" conditions have to match for it to be added to the selection set. You should only use "and" when looking at different properties. -4 is telling the ssget function look for lines that are black or white or bylayer. That's why its wrapped on both sides. You can do this a little easier with strings because you only need a , between see below. these are the same (setq ss (ssget "_:L" '((-4 . "<OR")(0 . "LINE")(0 . "CIRCLE")(0 . "ARC")(-4 . "OR>")))) (setq ss (ssget "_:L" '((0 . "LINE,CIRCLE,ARC")))) 1 hour ago, stlo said: I see that some objects are selected but none of them are highlighted so I can't apply any changes to them? you don't need to highlight them to make changes but if you want to only highlight them use sssetfirst (defun c:test (/ ss) (if (setq ss (ssget "_:L" '((0 . "LINE") (-4 . "<OR") (62 . 0) (62 . 7) (62 . 256) (-4 . "OR>")))) (sssetfirst nil SS) ) (princ) ) Quote
stlo Posted July 21, 2022 Posted July 21, 2022 Hi mhupp! Thank you very much! This helps me a lot to understand! Have a great day! Quote
stlo Posted August 31, 2022 Posted August 31, 2022 Hi everyone! I'm trying to select and erase dimensions, every text that has a 2.4 height and text that has the word SEAM in it! It's not working since all text height are selecting in the process! Can someone tells me what I have to modify in my lisp! And also, I need to know if I'm on the right path! The First code selects the text height correctly but no dimension! The second one is selecting all dimensions and all text height! Here's a dwg with with some elements that needs to be selected and others that don't! Thanks! (defun c:RAR (/ ss) (setq ss (ssget "_:L" '((-4 . "<OR") (0 . "DIMENSION") (0 . "TEXT") (-4 . "OR>")(-4 . "<OR") (40 . 2.4) (1 . "*SEAM*") (-4 . "OR>")))) (command "_.erase" ss"") (princ) ) (defun c:RAR (/ ss) (setq ss (ssget "_:L" '((-4 . "<OR") (0 . "DIMENSION") (0 . "TEXT") (-4 . "<OR") (40 . 2.4) (1 . "*SEAM*") (-4 . "OR>") (-4 . "OR>")))) (command "_.erase" ss"") (princ) ) QSELECT-DIM-TEXTHEIGHT.dwg Quote
ronjonp Posted August 31, 2022 Posted August 31, 2022 17 minutes ago, stlo said: Hi everyone! I'm trying to select and erase dimensions, every text that has a 2.4 height and text that has the word SEAM in it! It's not working since all text height are selecting in the process! Can someone tells me what I have to modify in my lisp! And also, I need to know if I'm on the right path! The First code selects the text height correctly but no dimension! The second one is selecting all dimensions and all text height! Here's a dwg with with some elements that needs to be selected and others that don't! Thanks! (defun c:RAR (/ ss) (setq ss (ssget "_:L" '((-4 . "<OR") (0 . "DIMENSION") (0 . "TEXT") (-4 . "OR>")(-4 . "<OR") (40 . 2.4) (1 . "*SEAM*") (-4 . "OR>")))) (command "_.erase" ss"") (princ) ) (defun c:RAR (/ ss) (setq ss (ssget "_:L" '((-4 . "<OR") (0 . "DIMENSION") (0 . "TEXT") (-4 . "<OR") (40 . 2.4) (1 . "*SEAM*") (-4 . "OR>") (-4 . "OR>")))) (command "_.erase" ss"") (princ) ) QSELECT-DIM-TEXTHEIGHT.dwg 97.35 kB · 0 downloads AFAIK you can't directly filter dimensions with a text height. Quote
stlo Posted August 31, 2022 Posted August 31, 2022 OK! Thanks for letting me know! I was trying really hard!!! Have a good one! 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.