MJLM Posted March 19, 2014 Author Share Posted March 19, 2014 I think that it's bad idea to colorize entities... Please, test this code, I think it's better approach to select entities... I have to say that it seems to work great! Only one thing, can we make it select all entities created after the one selected rather than all before? Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted March 19, 2014 Share Posted March 19, 2014 (edited) Here you go... You have to have Express Tools installed - it uses (acet-ss-remove) function... (defun c:selaents ( / _entnext ss e ent ) (defun _entnext ( en / ee ) (setq ee en) (while (wcmatch (cdr (assoc 0 (entget (setq ee (entnext ee))))) "ATTRIB,VERTEX,SEQEND")) ee ) (setq ss (ssadd)) (setq e (entnext)) (setq ent (car (entsel "\nPick entity for selecting entities created after picked entity"))) (while (not (equal e ent)) (ssadd e ss) (setq e (_entnext e)) ) (sssetfirst nil (ssdel ent (acet-ss-remove ss (ssget "_X")))) (princ) ) Edited March 19, 2014 by marko_ribar Quote Link to comment Share on other sites More sharing options...
MJLM Posted March 19, 2014 Author Share Posted March 19, 2014 marko_ribar, thank you very much! Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted March 19, 2014 Share Posted March 19, 2014 Both my codes changed to accept condition first-last entity picked... Test it now, please... Sorry for inconvenience, M.R. Quote Link to comment Share on other sites More sharing options...
MJLM Posted March 21, 2014 Author Share Posted March 21, 2014 Both my codes changed to accept condition first-last entity picked... Test it now, please... Sorry for inconvenience, M.R. I played with your code a bit and I came up with this simplified code which seems to work fine to get all entities from the one I select. (defun c:test (/) (setq ss (ssadd)) (setq e (entlast)) (setq ent (car (entsel "\nPick line for selecting entities created after picked line: "))) (while (not (equal ent e)) (ssadd ent ss) (setq ent (entnext ent)) ) (sssetfirst nil ss) ) I m posting this code not to compare. I m just trying to understand what do I need this wcmatch check. What does "ATTRIB,VERTEX,SEQEND" means? Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted March 21, 2014 Share Posted March 21, 2014 (edited) I m posting this code not to compare. I m just trying to understand what do I need this wcmatch check. What does "ATTRIB,VERTEX,SEQEND" means? If checked entity is parent entity that is if it contains child entities like ATTRIB or VERTEX entities (3dpolyline - VERTEX, 2d heavy polyline, pellipse which is type of 2d heavy polyline - VERTEX, insert - block with ATTRIB, dimension - block with ATTRIB, leader - block with ATTRIB), (entnext e) function will return - if e argument is one of mentioned entities, very next child entity that is VERTEX or ATTRIB, and these entities you can't select... Actually you have to step through them until next parent entity is found and that entity is then selectable... Very next parent entity after child entity such as SEQEND entity which comes after ATTRIB or VERTEX entity is entity that we are searching - it's selectable and you can add it into sel. set with (ssadd) function... If searched entites aren't parent - simple entities like LINE, CIRCLE, ARC, ELLIPSE, SPLINE, HELIX, LWPOLYLINE, INSERT without ATTRIBUTES, XLINE, RAY, TEXT, DTEXT, MTEXT... then (entnext e) will return very next BASE entity which can be simple entity mentioned or again parent, but if it's parent then you have to step through all it's child entities with (entnext) until next simple or parent BASE entity is reached... Only BASE entities you can add to sel. set which can then be used into selecting on screen with (sssetfirst) function... I hope I clayfied why (wcmatch) function was needed - to find with (_entnext) function which was defined as sub-function very next BASE entity; (while) loop used inside this sub-function was checking for all child entities and after SEQEND entity, next BASE entity is returned as result of evaluation of (_entnext) sub-function... Return value of very next base entity is last variable inside (_entnext) - variable "ee"... HTH, M.R. Edited March 21, 2014 by marko_ribar 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.