Jump to content

Remove certain objects from dynamic block.


BIGAL

Recommended Posts

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 ?

 

 

Edited by BIGAL
Link to comment
Share on other sites

like Steven said explode,overkill, purge this only removes it from model/paper space but then you have to detach the reference so its "removed" from the drawing.

 

I think it would still show up in "External refrences" like this.

unrefer.PNG.e03a226d3c957751d7ef13c8c28bd5dd.PNG.9564e44432a19498b1e6aac37968c017.PNG

 

Here is something Tharwat made.

  • Like 1
  • Agree 1
Link to comment
Share on other sites

You say no user input

How about a script to copy (edit-copy) and then Paste into a new drawing created from a virgin template??

could be tested manually.

 

Just a thought

Link to comment
Share on other sites

Mhupp the images are not referred as Xref as they are contained within the dwg, within the dynamic block.

 

Steven P tblsearch works. Will try overkill.

 

Trying to get a show object name in the dynamic block. Like a dump of every object inside a dynamic block. It looks like you can get every object in a normal block but not a dynamic block.

 

(vlax-for b (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
(if (= (vla-get-Name b) "blkname")
(vlax-for a b
(princ (vla-get-ObjectName a))
(princ "\n")
)
)
)

 

 

 

 

 

Edited by BIGAL
  • Like 1
Link to comment
Share on other sites

I have not really got any further just dug a bit deeper the visibility states contain an Ole. When you use bedit can delete the Ole's by deleting the visibility property. So have an idea now.

(setq blks (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))))
(setq blk (vla-item blks "block name"))
; (vla-delete blk)

(setq vis
    (vl-some
       '(lambda ( pair )
            (if
                (and
                    (= 360 (car pair))
                    (= "BLOCKVISIBILITYPARAMETER" (cdr (assoc 0 (entget (cdr pair)))))
                )
                (cdr pair)
            )
        )
        (dictsearch
            (vlax-vla-object->ename (vla-getextensiondictionary blk))
            "ACAD_ENHANCEDBLOCK"
        )
    )
)

; (entdel vis)

If you (entget vis) it exposes all the visibility structure, whilst (entdel vis) deletes the block  it is not cleaning up the Ole objects properly and erases the entire block. Possibly need to edit the extensiondictionary, similar with (vla-delete blk) as a short version. I get lost in entnext stuff may need to reset way more dxf items.

 (entget VIS)
(93 . 35) is the number of Ole objects -1 as 1st item is a Pline. (92 . 34) matches Ole

((-1 . <Entity name: 7cc77230>) (0 . "BLOCKVISIBILITYPARAMETER") (5 . "32F73") (330 . <Entity name: 7cc76df0>) (100 . "AcDbEvalExpr") (90 . 24) (98 . 33) (99 . 174) 
(100 . "AcDbBlockElement") (300 . "Visibility State") (98 . 27) (99 . 1) (1071 . 0) (100 . "AcDbBlockParameter") (280 . 1) (281 . 0) (
100 . "AcDbBlock1PtParameter") (1010 0.0 0.0 0.0) (93 . 25) (170 . 0) (171 . 0) (100 . "AcDbBlockVisibilityParameter") (281 . 1) 
(301 . "Visibility1") (302 . "") (91 . 0) (93 . 35) 
(331 . <Entity name: 7cc77af0>) 
(331 . <Entity name: 7cc7a030>) 
(331 . <Entity name: 7cc78c30>) 
................................................ continue for all 35
(92 . 34) 
(303 . "Blank") default setting
(94 . 2) 
(332 . <Entity name: 7cc77430>) 
(332 . <Entity name: 7cc77af0>) 
(95 . 4) 
(333 . <Entity name: 7cc76af0>) 
(333 . <Entity name: 7cc766f0>) 
(333 . <Entity name: 7cc766b0>) 
(333 . <Entity name: 7cc76cf0>) 
(303 . "IMG1") (94 . 1) (332 . <Entity name: 7cc77c30>) (95 . 0) 
(303 . "IMG2") (94 . 1) (332 . <Entity name: 7cc77d70>) (95 . 0) 
(303 . "IMG3") (94 . 1) (332 . <Entity name: 7cc77cf0>) (95 . 0) 
............................................................... continue for all 35

 

Edited by BIGAL
Link to comment
Share on other sites

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