dan113 Posted October 13, 2017 Share Posted October 13, 2017 I have a routine that draws some basic geometry in a blocks, sometimes this needs some basic editing 'by hand' is there a way to check/flag if the block has been edited? I'm really trying to avoid reactors. I only need an indicator to possible changes, as a prompt to check. The only way I can think of is to check the geometry inside the block against what it should be, but this would take a while on a drawing with potentially hundreds of blocks. If this is the only way then so be it but I'm open to ideas...... Sent from my Pixel XL using Tapatalk Quote Link to comment Share on other sites More sharing options...
rlx Posted October 13, 2017 Share Posted October 13, 2017 Maybe count number of ents inside block? Quote Link to comment Share on other sites More sharing options...
dan113 Posted October 13, 2017 Author Share Posted October 13, 2017 Maybe count number of ents inside block?The quantity of ents will rarely change just the lengths of the lines. The blocks generally contain an "L-section" profile that sometimes needs to be stretched and a triangular shape in others. Sent from my Pixel XL using Tapatalk Quote Link to comment Share on other sites More sharing options...
rlx Posted October 13, 2017 Share Posted October 13, 2017 (edited) If only entities inside the block itself change it will be a challenge indeed :-( In that case you will have to compare it to something else and for many blocks the challenge would be only greater I guess... If the outside were to change you could have simply check the scale or something. But then again , many smart peoples on the forum (I hope). gr.Rlx p.s. so we're talking about dynamic blocks here? Else all blocks of certain name would be updated? Edited October 13, 2017 by rlx Quote Link to comment Share on other sites More sharing options...
dan113 Posted October 13, 2017 Author Share Posted October 13, 2017 If only entities inside the block itself change it will be a challenge indeed :-( In that case you will have to compare it to something else and for many blocks the challenge would be only greater I guess... If the outside were to change you could have simply check the scale or something. But then again , many smart peoples on the forum (I hope). gr.Rlx p.s. so we're talking about dynamic blocks here? Else all blocks of certain name would be updated? These aren't dynamic blocks, they are very basic usually about 10 elements. I think testing total line length inside the block may be one option. Sent from my Pixel XL using Tapatalk Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted October 13, 2017 Share Posted October 13, 2017 You can compare entity lists with the equal function. Provided you filter out enames you should be able to compare all entities in a given block definition against a standard block definition (which may be contained in an ODBX database). Quote Link to comment Share on other sites More sharing options...
Grrr Posted October 13, 2017 Share Posted October 13, 2017 Good idea Roy! To elaborate it a bit with code example: (defun foo ( BlockName / e Lst ) (if (setq e (tblobjname "BLOCK" BlockName)) (while (and (setq e (entnext e)) (/= "ENDBLK" (cdr (assoc 0 (entget e))))) (setq Lst (cons (vl-remove-if '(lambda (x) (eq 'ENAME (type (cdr x)))) (entget e)) Lst)) ) ) Lst ); defun foo Then, store a global variable from the original block - to be compared later (or just copy/batch that list into the code): (setq *OriginalBlockData* (foo "MyBlock")) And then to check if it was modified: (equal *OriginalBlockData* (foo "MyBlock") 1e-6) Note: Altho (cdr (entget e)) would remove the potential -1 group code, there might be enames for the owners aswell in the elist. Quote Link to comment Share on other sites More sharing options...
dan113 Posted October 14, 2017 Author Share Posted October 14, 2017 This is a new concept for me, I will have a go and see how it goes thanks for the help chaps Sent from my Pixel XL using Tapatalk Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted October 14, 2017 Share Posted October 14, 2017 ... You would have to filter out handles as well. Quote Link to comment Share on other sites More sharing options...
Grrr Posted October 14, 2017 Share Posted October 14, 2017 ... You would have to filter out handles as well. Oh right! Quote Link to comment Share on other sites More sharing options...
dan113 Posted October 20, 2017 Author Share Posted October 20, 2017 The code you supplied worked a treat. I just filtered out the handles and owners and I got the result I was looking for, albeit in a different way I was expecting. Thanks guys Sent from my Pixel XL using Tapatalk 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.