Jump to content

Recommended Posts

Posted

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

Posted
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

Posted (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 by rlx
Posted
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

Posted

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).

Posted

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.

Posted

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

Posted

... You would have to filter out handles as well.

Posted

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

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...