| Author |
Message |
MP
Guest
|
Posted:
Fri Apr 08, 2005 1:53 am Post subject:
Re: question about accessing the "Undo memory" |
|
|
I know that one too well, unfortunately
:-)
"Tim Decker" <todecker_@_dynotecinc.com> wrote in message
news:42559b1f$1_2@newsprd01...
| Quote: | that what happens when you get old, and the eyes start deceiving you
|
|
|
| Back to top |
|
 |
T.Willey
Guest
|
Posted:
Fri Apr 08, 2005 2:46 am Post subject:
Re: question about accessing the "Undo memory" |
|
|
Could it be that the block you are trying to purge is a nested block in one of you others ones? Just and idea.
Tim |
|
| Back to top |
|
 |
MP
Guest
|
Posted:
Fri Apr 08, 2005 3:21 am Post subject:
Re: question about accessing the "Undo memory" |
|
|
Good thought.
However, the fact that closing and reopening the dwg allows the delete
suggests that's not the case in this instance.
That's what originally made me think about the undo buffer...which t.t.
elegantly pointed out would not be the case either.
Thanks for giving it some thought.
Mark
"T.Willey" <nospam@address.withheld> wrote in message
news:31263449.1112914033200.JavaMail.jive@jiveforum2.autodesk.com...
| Quote: | Could it be that the block you are trying to purge is a nested block in
one of you others ones? Just and idea.
Tim |
|
|
| Back to top |
|
 |
Tony Tanzillo
Guest
|
Posted:
Fri Apr 08, 2005 7:55 am Post subject:
Re: question about accessing the "Undo memory" |
|
|
"MP" <nospam@Thanks.com> wrote in message news:4255bffc$1_1@newsprd01...
| Quote: | Good thought.
However, the fact that closing and reopening the dwg allows the delete
suggests that's not the case in this instance.
|
The fact that you can reopen the drawing and purge
the block, would suggest that there is something in
the drawing that's referencing the block, and that is
being purged or discarded when drawing is saved,
and reopened.
For example, an unreferenced anonymous block that
contains an insertiion of the block that can't be
purged, will prevent you from deleting it, but when
AutoCAD saves/reopens the draiwng, it automatically
purges the unreferenced anonymous block, and the
block you want to purge then becomes unreferenced.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com |
|
| Back to top |
|
 |
MP
Guest
|
Posted:
Fri Apr 08, 2005 9:03 am Post subject:
Re: question about accessing the "Undo memory" |
|
|
"Tony Tanzillo" <tony.tanzillo@U_KNOW_WHERE.com> wrote in message
news:425600a7_1@newsprd01...
| Quote: | The fact that you can reopen the drawing and purge
the block, would suggest that there is something in
the drawing that's referencing the block, and that is
being purged or discarded when drawing is saved,
and reopened.
|
precisely!
:-)
| Quote: | For example, an unreferenced anonymous block that
contains an insertiion of the block that can't be
purged, will prevent you from deleting it, but when
AutoCAD saves/reopens the draiwng, it automatically
purges the unreferenced anonymous block, and the
block you want to purge then becomes unreferenced.
|
Hmmm.
Wonder what would have created an unreferenced anon block?
I can add a block def search for the block ref to make sure(in my goofy
little temp func).
....thinking out loud....would a foreach on the block collection catch anon
blocks?
I'll try...just never use anons for anything so not sure off hand.
Thanks for the ideas.
....back to the ...<computer>...drawing board
:-)
Mark |
|
| Back to top |
|
 |
MP
Guest
|
Posted:
Fri Apr 08, 2005 9:03 am Post subject:
Re: question about accessing the "Undo memory" |
|
|
"MP" <nospam@Thanks.com> wrote in message news:425616ef$1_1@newsprd01...
| Quote: | ...thinking out loud....would a foreach on the block collection catch anon
blocks?
|
why yes it will.
of course, now that i'm trying different things I'm not getting the same
failure anymore.
so there's some specific sequence of events that creates the previous
pattern.
I'll have to wait till it happens again to check some more.
Thanks to everyone for their ideas.
Mark |
|
| Back to top |
|
 |
MP
Guest
|
Posted:
Fri Apr 08, 2005 9:03 am Post subject:
Re: question about accessing the "Undo memory" |
|
|
"MP" <nospam@Thanks.com> wrote in message news:4256233f$1_2@newsprd01...
| Quote: |
so there's some specific sequence of events that creates the previous
pattern.
I'll have to wait till it happens again to check some more.
|
well that wasn't a very long wait
okay,
I had a block "COL-BASE-PLAN" embedded in another block "PORCH-SOUTH-PLAN"
I deleted the parent block
then ran deleteblock on the subblock
(I've revised deleteblock to also check for embedded references)
here's the result just after erasing and manually purging the parent block.
No inserts of COL-BASE-PLAN exist in dwg
COL-BASE-PLAN not embedded in any blocks
Failed to delete COL-BASE-PLAN
Automation Error. Object is referenced
then i did a save ("original.dwg") and reran deleteblock
results:
still referenced
then i did a saveas ("test.dwg") and reran deleteblock
results:
still referenced
then i reopened the original dwg name(before the saveas "test.dwg")
Successfully deleted COL-BASE-PLAN
voila
then i went back to "test.dwg"
tried deleteblock again
results:
still referenced
then i uncommented the (command"dxfout") line and reran
it did create a dxf file
but still won't let go of the unreferenced, unembedded block
now if i close it and reopen it, it will let go of it....here goes....
yep, sure nuf
Successfully deleted COL-BASE-PLAN
so it's referenced by something....just not another block
revised version of deleteblock
(defun c:deleteblock()
(adcfLoadList
(list
'adcfGet-Item
'adcfGet-Layer
'adcfGet-Object
'adcfGet-BlockDef
'adcfGet-ActiveDoc
))
(setq blkname "COL-BASE-PLAN"
)
(checkForDirectInsertions blkName)
(princ)
)
(defun checkForDirectInsertions (blkName / blkObj blkSet res idx)
(setq blkobj(adcfGet-BlockDef(adcfGet-ActiveDoc) blkname))
(setq blkset(ssget"x"(list(cons 2 blkname))))
(if(not blkset)
(progn
(princ(strcat "\nNo inserts of " blkname " exist in dwg"))
;uncomment next line to dxfout
;(command"dxfout")
(checkForNestedBlocks blkname)
(if
(null
(vl-catch-all-error-p
(setq res
(vl-catch-all-apply
'vla-delete
(list blkobj)
)
)
)
);null
(princ(strcat"\nSuccessfully deleted " blkname))
(princ(strcat"\nFailed to delete " blkname "\n"
(vl-catch-all-error-message res)))
);if
);progn
(progn
(princ(strcat"\nFound " (itoa (sslength blkset)) " inserts of " blkname))
(setq idx 0)
(repeat(sslength blkset)
(princ(strcat"\nOn Layer: "(adcfGet-Layer(adcfGet-Object(ssname blkset
idx)))))
(setq idx (1+ idx)))
)
);if
)
(defun CheckForNestedBlocks(blkName / parentBlock blkCol foundit)
(adcfLoadList
(list
'adcfType-IsBlock
'adcfGet-Blocks
'adcfGet-Name
'adcfGet-ActiveDoc
))
(setq blkName(strcase blkName))
(setq blkCol(adcfGet-Blocks(adcfGet-ActiveDoc)))
(vlax-for oBlk blkCol
(vlax-for oItem oBlk
(if(adcfType-IsBlock oItem)
(if(=(strcase(adcfGet-Name oItem))blkName)
(progn
(setq foundit 1)
(setq parentBlock(adcfGet-Name oblk))
(princ(strcat "\nFound " blkName " embedded in " parentBlock ))
;delete parent if it's unreferenced...
(checkForDirectInsertions parentBlock)
)
)
)
);for item in block
);for block
(if(not foundit)
(princ(strcat "\n" blkName " not embedded in any blocks")))
) |
|
| Back to top |
|
 |
|
|
|
|