Author Topic: Removing objects from a dynamic block  (Read 2176 times)

0 Members and 1 Guest are viewing this topic.

BIGAL

  • Swamp Rat
  • Posts: 1417
  • 40 + years of using Autocad
Removing objects from a dynamic block
« on: December 20, 2023, 06:54:43 PM »
I have a client supplied dynamic block that has images as the visibility state that works great, the problem is don't want the dynamic block in a dwg sent to external clients, so exploding the dynamic block works and the last visibility state ends up as Ole, which is fine.

Finding any copies of the block and deleting them plus removing the source block works also.

But the problem for some reason it leaves the ghost of the images or that is what I think it's doing as the dwg is huge 38mb playing around have seen same as 800kb which is what should happen.

I have spent some time searching and all points to the possible editing of the block. Remove the images then try removing any occurrences of the block. Doing it manually for 25 visibilities is not the way required as there is to be no user input as part of the procedure. So need a delete dynamic block object from a dynamic block.

I can not post the block !

Any ideas ?
A man who never made a mistake never made anything

CodeDing

  • Newt
  • Posts: 51
Re: Removing objects from a dynamic block
« Reply #1 on: December 28, 2023, 10:10:08 AM »
BIGAL,

Can you post ANY block as an example? It doesn't have to be the one from your client.

That would help a bunch. Because you start by saying:
Quote
I have a client supplied dynamic block that has images as the visibility state

...then later you say:
Quote
So need a delete dynamic block object from a dynamic block

So I'm a bit confused on whether the block has images or the block has blocks?

How you insert the block into the dwg matters also.
For example, if the block resides in another dwg such as "client_block.dwg" and the block is named "image_block"... and if you insert the DWG (so that the block subsequently comes with it) then you will have 2 new block definitions in your current dwg... But if you use Design Center to insert the BLOCK ONLY, then you only have 1 new block inserted into your current dwg.

So I think workflow matters here also.

Best,
~DD
~DD
Senior CAD Tech & AI Specialist
Need AutoLisp help?
Try my custom GPT 'AutoLISP Ace'

BIGAL

  • Swamp Rat
  • Posts: 1417
  • 40 + years of using Autocad
Re: Removing objects from a dynamic block
« Reply #2 on: December 28, 2023, 08:15:22 PM »
Thanks for responding, the dynamic block has 34 visibilty states, each visibilty state has an Ole object an image company Logo pasted from say paintbrush. The aim is that the user selects a client by name their image is made current visibility state, I explode the block so it now becomes a Ole2Frame an image of the client logo etc.

I proceed to look for any other occurrences of this block and delete them, yes they are "*U123" blocks but using effective name are found and deleted.

The original dynamic block is still in the block table, so I tried Purge and Vl delete the block from table, but the images are still in my dwg but as like ghost objects the dwg should be like 800kb at moment can be 32Mb when saved. An audit shows the 34 ole are there and repaired.

 I am trying to remove the ole objects from the dynamic block.

The critical step is that went sent to the client they do not see or find the other 33 company logo's. All this with the end user having no idea how all this is working, they just choose client name.

Hope that helps explain. I am using Bricscad V20 so hard to edit the dynamic block.

I can supply code up to get visibilty states from a entget it shows all 34, if that helps.
A man who never made a mistake never made anything

kozmos

  • Newt
  • Posts: 114
Re: Removing objects from a dynamic block
« Reply #3 on: December 29, 2023, 01:35:04 AM »
I would recommend you to explode the dynamic block with expired visibility state to had the active oleframe, then use it to redefine the logo block. after that, can try a wblock to clear all other redundant oleframes
KozMos Inc.

57gmc

  • Bull Frog
  • Posts: 366
Re: Removing objects from a dynamic block
« Reply #4 on: December 29, 2023, 12:58:42 PM »
I'm on vacation now, but it sounds to me like once you explode the db, then all the images are getting embedded in the dwg. You would then have to use OLE to try to find the images and delete them. You would have to iterate the db looking for AcadOle objects.

I would like to suggest an alternative. Create 32 standard blocks and store in a folder. Then start a command that reads the filenames in the folder and presents them in a dialog. The user chooses a customer and the block gets inserted automatically in the right location, layer, etc. This also has the benefit that if they get a new customer or need to delete one, they just manage the blocks in the folder. Also, there is no chance of contamination with other customer images if they are never created.
« Last Edit: December 29, 2023, 01:05:56 PM by 57gmc »

CodeDing

  • Newt
  • Posts: 51
Re: Removing objects from a dynamic block
« Reply #5 on: December 29, 2023, 01:55:22 PM »
BIGAL,

Maybe try creating an empty drawing and testing from there. You could progressively add more items/blocks to test as necessary. I could not duplicate from AutoCAD 2019 (see snips). I know you said you're in Bricscad but that's the best I got unless we can iron out where the problem is stemming from.

My workflow:
- Create 30-image block ("Logos") in "Image_Block.dwg"
- create empty "Drawing1.dwg"
- add "Logos" block into Drawing1 (via Design Center) (Only block added, not "Drawing1" block also)
- Save Drawing1 (confirmed, similar size as "Image_Block.dwg")
- explode Logos block so that desired OLE in Drawing1
- Purge Drawing 1 Logos block & save (confirmed, now smaller size than when full Logos block was in dwg)

Best,
~DD
~DD
Senior CAD Tech & AI Specialist
Need AutoLisp help?
Try my custom GPT 'AutoLISP Ace'

CodeDing

  • Newt
  • Posts: 51
Re: Removing objects from a dynamic block
« Reply #6 on: December 29, 2023, 01:57:34 PM »
Aattaching my "Image_Block.dwg" for testing if people want.
~DD
Senior CAD Tech & AI Specialist
Need AutoLisp help?
Try my custom GPT 'AutoLISP Ace'

BIGAL

  • Swamp Rat
  • Posts: 1417
  • 40 + years of using Autocad
Re: Removing objects from a dynamic block
« Reply #7 on: December 29, 2023, 09:45:04 PM »
I have been doing more testing using Acad rather than my Bricscad V20 and have found that is where the problem exists, the code appears to be working in Acad, I am looking at upgrading my Bricscad to V24 and hopefully in that version the problem is fixed.

CodeDing I do appreciate the help that you provided. It is interesting using your image block I get "Ole Frame" objects but using the client block I get "Ole2frame" objects. For the moment I can put it on the back burner and wait for a new Bricscad upgrade and see if that fixes it.

A man who never made a mistake never made anything