question about accessing the "Undo memory"
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
question about accessing the "Undo memory"
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization
Author Message
MP
Guest





Posted: Thu Apr 07, 2005 10:04 pm    Post subject: question about accessing the "Undo memory" Reply with quote

situation:
I erase all instances of a given block
I run the following deleteblock routine.(just a temp routine to demonstrate
the problem)

although no instances exist, the definition is still referenced

If i close and reopen the dwg the def is not referenced and it can be
purged(vla-delete)

My assumption is that the reference is contained in the "undo memory" or
whatever that is called.

Is there any way other than closing and reopening to selectively flush an
object from the "undo memory"?
probably not, just thought I'd ask

Thanks
Mark

--------------------------------------
printout on textscreen:
(after erasing all instances of block)
DELETEBLOCK

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Failed to delete PORCH-NORTH-BEAMS-PLAN
Automation Error. Object is referenced

--------------------------------------

after closing and reopening
--------------------------------------

Command: deleteblock

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Successfully deleted PORCH-NORTH-BEAMS-PLAN

--------------------------------------


here is the deleteblock routine.
the weird function names are just my toolbox versions - hopefully obvious
from the name what they do

(defun c:deleteblock()
(adcfLoadList
(list
'adcfGet-BlockDef
'adcfGet-ActiveDoc
))

(setq blkname "PORCH-NORTH-BEAMS-PLAN"
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"))
(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))
)
);if
(princ)
)

Back to top
Jeff Mishler
Guest





Posted: Thu Apr 07, 2005 10:18 pm    Post subject: Re: question about accessing the "Undo memory" Reply with quote

What version? I just tested this in 2002 and it worked as expected:

Command: deleteblock

Found 1 inserts of car

Command:
Command: e ERASE
Select objects: 1 found

Select objects:
Command: deleteblock

No inserts of car exist in dwg
Successfully deleted car

Command:

--
Jeff
check out www.cadvault.com
"MP" <nospam@Thanks.com> wrote in message news:425575d2$1_2@newsprd01...
Quote:
situation:
I erase all instances of a given block
I run the following deleteblock routine.(just a temp routine to
demonstrate
the problem)

although no instances exist, the definition is still referenced

If i close and reopen the dwg the def is not referenced and it can be
purged(vla-delete)

My assumption is that the reference is contained in the "undo memory" or
whatever that is called.

Is there any way other than closing and reopening to selectively flush an
object from the "undo memory"?
probably not, just thought I'd ask

Thanks
Mark

--------------------------------------
printout on textscreen:
(after erasing all instances of block)
DELETEBLOCK

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Failed to delete PORCH-NORTH-BEAMS-PLAN
Automation Error. Object is referenced

--------------------------------------

after closing and reopening
--------------------------------------

Command: deleteblock

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Successfully deleted PORCH-NORTH-BEAMS-PLAN

--------------------------------------


here is the deleteblock routine.
the weird function names are just my toolbox versions - hopefully obvious
from the name what they do

(defun c:deleteblock()
(adcfLoadList
(list
'adcfGet-BlockDef
'adcfGet-ActiveDoc
))

(setq blkname "PORCH-NORTH-BEAMS-PLAN"
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"))
(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))
)
);if
(princ)
)

Back to top
Tim Decker
Guest





Posted: Thu Apr 07, 2005 10:30 pm    Post subject: Re: question about accessing the "Undo memory" Reply with quote

You are dealing with two separate things, one is the block insertion,
and the other is th block reference. The reference is a completely separate
item, so even if you erase all of the insertions, that does not delete the
reference from autocads block tables. Has nothing to do with the undo
buffer/memory. You can think of it this way: the reference stores all of
the entity information about the block, which takes up as much space as it
would to have drawn all of the things that compose it, as well as an entry
for the name of the reference; the insertion is just treated as a single
entity which calls back to the drawing with whatever name you told it that
it was supposed to be (this saves gobs of space since the reference is the
only object that has all of the drawn entities in it). As a defense
mechanism, autocad will not let you purge a reference, unless all of the
insertions who are calling to it are erased, otherwise you would have what
they call an "undefined" block, which can cause all kinds of problems.
Hope this explains how block references work in a drawing. External
references work on the same theory, but instead of the data about the
entities that make up the block being stored within the working drawing,
they are instead stored in an external drawing file, and then referenced in
upon loading of the working drawing.

"MP" <nospam@Thanks.com> wrote in message news:425575d2$1_2@newsprd01...
Quote:
situation:
I erase all instances of a given block
I run the following deleteblock routine.(just a temp routine to
demonstrate
the problem)

although no instances exist, the definition is still referenced

If i close and reopen the dwg the def is not referenced and it can be
purged(vla-delete)

My assumption is that the reference is contained in the "undo memory" or
whatever that is called.

Is there any way other than closing and reopening to selectively flush an
object from the "undo memory"?
probably not, just thought I'd ask

Thanks
Mark

--------------------------------------
printout on textscreen:
(after erasing all instances of block)
DELETEBLOCK

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Failed to delete PORCH-NORTH-BEAMS-PLAN
Automation Error. Object is referenced

--------------------------------------

after closing and reopening
--------------------------------------

Command: deleteblock

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Successfully deleted PORCH-NORTH-BEAMS-PLAN

--------------------------------------


here is the deleteblock routine.
the weird function names are just my toolbox versions - hopefully obvious
from the name what they do

(defun c:deleteblock()
(adcfLoadList
(list
'adcfGet-BlockDef
'adcfGet-ActiveDoc
))

(setq blkname "PORCH-NORTH-BEAMS-PLAN"
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"))
(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))
)
);if
(princ)
)



Back to top
Tony Tanzillo
Guest





Posted: Thu Apr 07, 2005 11:00 pm    Post subject: Re: question about accessing the "Undo memory" Reply with quote

With all due respect, the poster already fully understands
the difference between a block and a block reference. I
think you may not have understood the problem he's having.

He is trying to delete the block (definition) object, when
there are no references to the block found in any layout.

Normally, AutoCAD will allow a block object to be deleted
if there are no references to it, but in this case, it isn't.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Tim Decker" <todecker_@_dynotecinc.com> wrote in message news:42557c5a_3@newsprd01...
Quote:
You are dealing with two separate things, one is the block insertion, and the other is th block reference. The
reference is a completely separate item, so even if you erase all of the insertions, that does not delete the
reference from autocads block tables. Has nothing to do with the undo buffer/memory. You can think of it this way:
the reference stores all of the entity information about the block, which takes up as much space as it would to have
drawn all of the things that compose it, as well as an entry for the name of the reference; the insertion is just
treated as a single entity which calls back to the drawing with whatever name you told it that it was supposed to be
(this saves gobs of space since the reference is the only object that has all of the drawn entities in it). As a
defense mechanism, autocad will not let you purge a reference, unless all of the insertions who are calling to it are
erased, otherwise you would have what they call an "undefined" block, which can cause all kinds of problems.
Hope this explains how block references work in a drawing. External references work on the same theory, but
instead of the data about the entities that make up the block being stored within the working drawing, they are
instead stored in an external drawing file, and then referenced in upon loading of the working drawing.

"MP" <nospam@Thanks.com> wrote in message news:425575d2$1_2@newsprd01...
situation:
I erase all instances of a given block
I run the following deleteblock routine.(just a temp routine to demonstrate
the problem)

although no instances exist, the definition is still referenced

If i close and reopen the dwg the def is not referenced and it can be
purged(vla-delete)

My assumption is that the reference is contained in the "undo memory" or
whatever that is called.

Is there any way other than closing and reopening to selectively flush an
object from the "undo memory"?
probably not, just thought I'd ask

Thanks
Mark

--------------------------------------
printout on textscreen:
(after erasing all instances of block)
DELETEBLOCK

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Failed to delete PORCH-NORTH-BEAMS-PLAN
Automation Error. Object is referenced

--------------------------------------

after closing and reopening
--------------------------------------

Command: deleteblock

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Successfully deleted PORCH-NORTH-BEAMS-PLAN

--------------------------------------


here is the deleteblock routine.
the weird function names are just my toolbox versions - hopefully obvious
from the name what they do

(defun c:deleteblock()
(adcfLoadList
(list
'adcfGet-BlockDef
'adcfGet-ActiveDoc
))

(setq blkname "PORCH-NORTH-BEAMS-PLAN"
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"))
(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))
)
);if
(princ)
)



Back to top
Tony Tanzillo
Guest





Posted: Thu Apr 07, 2005 11:06 pm    Post subject: Re: question about accessing the "Undo memory" Reply with quote

Can you do a DXFOUT of the file, at the point where
attempting to delete the block fails? UNDO memory
should not affect this, because you could not undo
the erasure of any references before you undo the
deletion of the block.

However, if you suspect that this may not be the
case, then issue UNDO/Control/None followed by
UNDO/All, and that should cause AutoCAD to discard
undo information up to that point.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"MP" <nospam@Thanks.com> wrote in message news:425575d2$1_2@newsprd01...
Quote:
situation:
I erase all instances of a given block
I run the following deleteblock routine.(just a temp routine to demonstrate
the problem)

although no instances exist, the definition is still referenced

If i close and reopen the dwg the def is not referenced and it can be
purged(vla-delete)

My assumption is that the reference is contained in the "undo memory" or
whatever that is called.

Is there any way other than closing and reopening to selectively flush an
object from the "undo memory"?
probably not, just thought I'd ask

Thanks
Mark

--------------------------------------
printout on textscreen:
(after erasing all instances of block)
DELETEBLOCK

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Failed to delete PORCH-NORTH-BEAMS-PLAN
Automation Error. Object is referenced

--------------------------------------

after closing and reopening
--------------------------------------

Command: deleteblock

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Successfully deleted PORCH-NORTH-BEAMS-PLAN

--------------------------------------


here is the deleteblock routine.
the weird function names are just my toolbox versions - hopefully obvious
from the name what they do

(defun c:deleteblock()
(adcfLoadList
(list
'adcfGet-BlockDef
'adcfGet-ActiveDoc
))

(setq blkname "PORCH-NORTH-BEAMS-PLAN"
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"))
(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))
)
);if
(princ)
)

Back to top
Tim Decker
Guest





Posted: Thu Apr 07, 2005 11:17 pm    Post subject: Re: question about accessing the "Undo memory" Reply with quote

According to the routine he was using, it was only deleting the insertions
of the block only. So I explained why doing that still leaves the
reference. The routine does not attempt to remove the definition at all. I
drew my conclusions from that.

"Tony Tanzillo" <tony.tanzillo@U_KNOW_WHERE.com> wrote in message
news:425584b1_2@newsprd01...
Quote:
With all due respect, the poster already fully understands
the difference between a block and a block reference. I
think you may not have understood the problem he's having.

He is trying to delete the block (definition) object, when
there are no references to the block found in any layout.

Normally, AutoCAD will allow a block object to be deleted
if there are no references to it, but in this case, it isn't.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Tim Decker" <todecker_@_dynotecinc.com> wrote in message
news:42557c5a_3@newsprd01...
You are dealing with two separate things, one is the block insertion,
and the other is th block reference. The reference is a completely
separate item, so even if you erase all of the insertions, that does not
delete the reference from autocads block tables. Has nothing to do with
the undo buffer/memory. You can think of it this way: the reference
stores all of the entity information about the block, which takes up as
much space as it would to have drawn all of the things that compose it,
as well as an entry for the name of the reference; the insertion is just
treated as a single entity which calls back to the drawing with whatever
name you told it that it was supposed to be (this saves gobs of space
since the reference is the only object that has all of the drawn entities
in it). As a defense mechanism, autocad will not let you purge a
reference, unless all of the insertions who are calling to it are erased,
otherwise you would have what they call an "undefined" block, which can
cause all kinds of problems.
Hope this explains how block references work in a drawing. External
references work on the same theory, but instead of the data about the
entities that make up the block being stored within the working drawing,
they are instead stored in an external drawing file, and then referenced
in upon loading of the working drawing.

"MP" <nospam@Thanks.com> wrote in message news:425575d2$1_2@newsprd01...
situation:
I erase all instances of a given block
I run the following deleteblock routine.(just a temp routine to
demonstrate
the problem)

although no instances exist, the definition is still referenced

If i close and reopen the dwg the def is not referenced and it can be
purged(vla-delete)

My assumption is that the reference is contained in the "undo memory" or
whatever that is called.

Is there any way other than closing and reopening to selectively flush
an
object from the "undo memory"?
probably not, just thought I'd ask

Thanks
Mark

--------------------------------------
printout on textscreen:
(after erasing all instances of block)
DELETEBLOCK

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Failed to delete PORCH-NORTH-BEAMS-PLAN
Automation Error. Object is referenced

--------------------------------------

after closing and reopening
--------------------------------------

Command: deleteblock

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Successfully deleted PORCH-NORTH-BEAMS-PLAN

--------------------------------------


here is the deleteblock routine.
the weird function names are just my toolbox versions - hopefully
obvious
from the name what they do

(defun c:deleteblock()
(adcfLoadList
(list
'adcfGet-BlockDef
'adcfGet-ActiveDoc
))

(setq blkname "PORCH-NORTH-BEAMS-PLAN"
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"))
(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))
)
);if
(princ)
)





Back to top
Tony Tanzillo
Guest





Posted: Thu Apr 07, 2005 11:23 pm    Post subject: Re: question about accessing the "Undo memory" Reply with quote

"Tim Decker" <todecker_@_dynotecinc.com> wrote in message news:4255873a_1@newsprd01...

Quote:
According to the routine he was using, it was only deleting the insertions of the block only.

You might want to take another look at it.

The routine he posted doesn't delete any insertions
of the block, it only checks to see if there are any
insertions, and if there aren't, it deletes the block
(definition) object.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
Back to top
Jeff Mishler
Guest





Posted: Thu Apr 07, 2005 11:23 pm    Post subject: Re: question about accessing the "Undo memory" Reply with quote

*BZZT* Wrong answer.......

Quote:
(setq blkname "PORCH-NORTH-BEAMS-PLAN"
blkobj(adcfGet-BlockDef(adcfGet-ActiveDoc) blkname )
)
The above gets the Block definition from the block table.

And the following attempts to delete it:

Quote:
(vl-catch-all-apply
'vla-delete
(list blkobj)
)

--
Jeff
check out www.cadvault.com
"Tim Decker" <todecker_@_dynotecinc.com> wrote in message
news:4255873a_1@newsprd01...
Quote:
According to the routine he was using, it was only deleting the insertions
of the block only. So I explained why doing that still leaves the
reference. The routine does not attempt to remove the definition at all.
I drew my conclusions from that.

"Tony Tanzillo" <tony.tanzillo@U_KNOW_WHERE.com> wrote in message
news:425584b1_2@newsprd01...
With all due respect, the poster already fully understands
the difference between a block and a block reference. I
think you may not have understood the problem he's having.

He is trying to delete the block (definition) object, when
there are no references to the block found in any layout.

Normally, AutoCAD will allow a block object to be deleted
if there are no references to it, but in this case, it isn't.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Tim Decker" <todecker_@_dynotecinc.com> wrote in message
news:42557c5a_3@newsprd01...
You are dealing with two separate things, one is the block insertion,
and the other is th block reference. The reference is a completely
separate item, so even if you erase all of the insertions, that does not
delete the reference from autocads block tables. Has nothing to do with
the undo buffer/memory. You can think of it this way: the reference
stores all of the entity information about the block, which takes up as
much space as it would to have drawn all of the things that compose it,
as well as an entry for the name of the reference; the insertion is just
treated as a single entity which calls back to the drawing with whatever
name you told it that it was supposed to be (this saves gobs of space
since the reference is the only object that has all of the drawn
entities in it). As a defense mechanism, autocad will not let you purge
a reference, unless all of the insertions who are calling to it are
erased, otherwise you would have what they call an "undefined" block,
which can cause all kinds of problems.
Hope this explains how block references work in a drawing. External
references work on the same theory, but instead of the data about the
entities that make up the block being stored within the working drawing,
they are instead stored in an external drawing file, and then referenced
in upon loading of the working drawing.

"MP" <nospam@Thanks.com> wrote in message news:425575d2$1_2@newsprd01...
situation:
I erase all instances of a given block
I run the following deleteblock routine.(just a temp routine to
demonstrate
the problem)

although no instances exist, the definition is still referenced

If i close and reopen the dwg the def is not referenced and it can be
purged(vla-delete)

My assumption is that the reference is contained in the "undo memory"
or
whatever that is called.

Is there any way other than closing and reopening to selectively flush
an
object from the "undo memory"?
probably not, just thought I'd ask

Thanks
Mark

--------------------------------------
printout on textscreen:
(after erasing all instances of block)
DELETEBLOCK

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Failed to delete PORCH-NORTH-BEAMS-PLAN
Automation Error. Object is referenced

--------------------------------------

after closing and reopening
--------------------------------------

Command: deleteblock

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Successfully deleted PORCH-NORTH-BEAMS-PLAN

--------------------------------------


here is the deleteblock routine.
the weird function names are just my toolbox versions - hopefully
obvious
from the name what they do

(defun c:deleteblock()
(adcfLoadList
(list
'adcfGet-BlockDef
'adcfGet-ActiveDoc
))

(setq blkname "PORCH-NORTH-BEAMS-PLAN"
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"))
(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))
)
);if
(princ)
)







Back to top
MP
Guest





Posted: Thu Apr 07, 2005 11:39 pm    Post subject: Re: question about accessing the "Undo memory" Reply with quote

Sorry Tim,
I guess my function names aren't as self-explanatory as I thought they were.
(adcfGet-BlockDef(adcfGet-ActiveDoc) blkname )

returns the vla-object referring to the block definition in the block table
of the currently active document
the routine didn't actually erase any inserts
they were erased manually before running this routine
this temp routine was just demonstrating that even without insertions there
were references being held by acad.

You're right that often times beginners confuse block refs with block defs.
(Just happens that is one of the few things I do understand!)
:-)

Thanks for trying anyway.
Mark

"Tim Decker" <todecker_@_dynotecinc.com> wrote in message
news:4255873a_1@newsprd01...
Quote:
According to the routine he was using, it was only deleting the insertions
of the block only. So I explained why doing that still leaves the
reference. The routine does not attempt to remove the definition at all.
I
drew my conclusions from that.

"Tony Tanzillo" <tony.tanzillo@U_KNOW_WHERE.com> wrote in message
news:425584b1_2@newsprd01...
With all due respect, the poster already fully understands
the difference between a block and a block reference. I
think you may not have understood the problem he's having.

He is trying to delete the block (definition) object, when
there are no references to the block found in any layout.

Normally, AutoCAD will allow a block object to be deleted
if there are no references to it, but in this case, it isn't.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Tim Decker" <todecker_@_dynotecinc.com> wrote in message
news:42557c5a_3@newsprd01...
You are dealing with two separate things, one is the block
insertion,
and the other is th block reference. The reference is a completely
separate item, so even if you erase all of the insertions, that does
not
delete the reference from autocads block tables. Has nothing to do
with
the undo buffer/memory. You can think of it this way: the reference
stores all of the entity information about the block, which takes up as
much space as it would to have drawn all of the things that compose it,
as well as an entry for the name of the reference; the insertion is
just
treated as a single entity which calls back to the drawing with
whatever
name you told it that it was supposed to be (this saves gobs of space
since the reference is the only object that has all of the drawn
entities
in it). As a defense mechanism, autocad will not let you purge a
reference, unless all of the insertions who are calling to it are
erased,
otherwise you would have what they call an "undefined" block, which can
cause all kinds of problems.
Hope this explains how block references work in a drawing. External
references work on the same theory, but instead of the data about the
entities that make up the block being stored within the working
drawing,
they are instead stored in an external drawing file, and then
referenced
in upon loading of the working drawing.

"MP" <nospam@Thanks.com> wrote in message
news:425575d2$1_2@newsprd01...
situation:
I erase all instances of a given block
I run the following deleteblock routine.(just a temp routine to
demonstrate
the problem)

although no instances exist, the definition is still referenced

If i close and reopen the dwg the def is not referenced and it can be
purged(vla-delete)

My assumption is that the reference is contained in the "undo memory"
or
whatever that is called.

Is there any way other than closing and reopening to selectively flush
an
object from the "undo memory"?
probably not, just thought I'd ask

Thanks
Mark

--------------------------------------
printout on textscreen:
(after erasing all instances of block)
DELETEBLOCK

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Failed to delete PORCH-NORTH-BEAMS-PLAN
Automation Error. Object is referenced

--------------------------------------

after closing and reopening
--------------------------------------

Command: deleteblock

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Successfully deleted PORCH-NORTH-BEAMS-PLAN

--------------------------------------


here is the deleteblock routine.
the weird function names are just my toolbox versions - hopefully
obvious
from the name what they do

(defun c:deleteblock()
(adcfLoadList
(list
'adcfGet-BlockDef
'adcfGet-ActiveDoc
))

(setq blkname "PORCH-NORTH-BEAMS-PLAN"
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"))
(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))
)
);if
(princ)
)







Back to top
MP
Guest





Posted: Thu Apr 07, 2005 11:40 pm    Post subject: Re: question about accessing the "Undo memory" Reply with quote

2005
Thanks for checking
:-)

Mark

"Jeff Mishler" <jeff_m@cadvault.com> wrote in message
news:42557968_3@newsprd01...
> What version? I just tested this in 2002 and it worked as expected:
Back to top
MP
Guest





Posted: Fri Apr 08, 2005 12:32 am    Post subject: Re: question about accessing the "Undo memory" Reply with quote

"Tony Tanzillo" <tony.tanzillo@U_KNOW_WHERE.com> wrote in message
news:425584b2_2@newsprd01...
Quote:
Can you do a DXFOUT of the file, at the point where
attempting to delete the block fails?

UNDO memory
Quote:
should not affect this, because you could not undo
the erasure of any references before you undo the
deletion of the block.

ha!
good point
silly me
I just couldn't think of what else would hold onto the def.
I just tried it in a blank dwg, create simple block, erase, run routine,
deletes just fine.
but in 'real' dwgs that have been worked on for a while and where various
blocks have been created, i get the weird effect.
hmmmm...what could it be....
I'll try the dxfout next time i get one that won't delete.
What is that going to tell me?

Quote:

However, if you suspect that this may not be the
case, then issue UNDO/Control/None followed by
UNDO/All, and that should cause AutoCAD to discard
undo information up to that point.
Back to top
Tim Decker
Guest





Posted: Fri Apr 08, 2005 12:39 am    Post subject: Re: question about accessing the "Undo memory" Reply with quote

my bad, mistook one of the functions, and got cornfused.

"Tony Tanzillo" <tony.tanzillo@U_KNOW_WHERE.com> wrote in message
news:425588a3_3@newsprd01...
Quote:
"Tim Decker" <todecker_@_dynotecinc.com> wrote in message
news:4255873a_1@newsprd01...

According to the routine he was using, it was only deleting the
insertions of the block only.

You might want to take another look at it.

The routine he posted doesn't delete any insertions
of the block, it only checks to see if there are any
insertions, and if there aren't, it deletes the block
(definition) object.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

Back to top
Tim Decker
Guest





Posted: Fri Apr 08, 2005 12:40 am    Post subject: Re: question about accessing the "Undo memory" Reply with quote

Thats the one i mistook, sorry guys.

"MP" <nospam@Thanks.com> wrote in message news:42558bf0$1_2@newsprd01...
Quote:
Sorry Tim,
I guess my function names aren't as self-explanatory as I thought they
were.
(adcfGet-BlockDef(adcfGet-ActiveDoc) blkname )

returns the vla-object referring to the block definition in the block
table
of the currently active document
the routine didn't actually erase any inserts
they were erased manually before running this routine
this temp routine was just demonstrating that even without insertions
there
were references being held by acad.

You're right that often times beginners confuse block refs with block
defs.
(Just happens that is one of the few things I do understand!)
:-)

Thanks for trying anyway.
Mark

"Tim Decker" <todecker_@_dynotecinc.com> wrote in message
news:4255873a_1@newsprd01...
According to the routine he was using, it was only deleting the
insertions
of the block only. So I explained why doing that still leaves the
reference. The routine does not attempt to remove the definition at all.
I
drew my conclusions from that.

"Tony Tanzillo" <tony.tanzillo@U_KNOW_WHERE.com> wrote in message
news:425584b1_2@newsprd01...
With all due respect, the poster already fully understands
the difference between a block and a block reference. I
think you may not have understood the problem he's having.

He is trying to delete the block (definition) object, when
there are no references to the block found in any layout.

Normally, AutoCAD will allow a block object to be deleted
if there are no references to it, but in this case, it isn't.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Tim Decker" <todecker_@_dynotecinc.com> wrote in message
news:42557c5a_3@newsprd01...
You are dealing with two separate things, one is the block
insertion,
and the other is th block reference. The reference is a completely
separate item, so even if you erase all of the insertions, that does
not
delete the reference from autocads block tables. Has nothing to do
with
the undo buffer/memory. You can think of it this way: the reference
stores all of the entity information about the block, which takes up
as
much space as it would to have drawn all of the things that compose
it,
as well as an entry for the name of the reference; the insertion is
just
treated as a single entity which calls back to the drawing with
whatever
name you told it that it was supposed to be (this saves gobs of space
since the reference is the only object that has all of the drawn
entities
in it). As a defense mechanism, autocad will not let you purge a
reference, unless all of the insertions who are calling to it are
erased,
otherwise you would have what they call an "undefined" block, which
can
cause all kinds of problems.
Hope this explains how block references work in a drawing.
External
references work on the same theory, but instead of the data about the
entities that make up the block being stored within the working
drawing,
they are instead stored in an external drawing file, and then
referenced
in upon loading of the working drawing.

"MP" <nospam@Thanks.com> wrote in message
news:425575d2$1_2@newsprd01...
situation:
I erase all instances of a given block
I run the following deleteblock routine.(just a temp routine to
demonstrate
the problem)

although no instances exist, the definition is still referenced

If i close and reopen the dwg the def is not referenced and it can be
purged(vla-delete)

My assumption is that the reference is contained in the "undo memory"
or
whatever that is called.

Is there any way other than closing and reopening to selectively
flush
an
object from the "undo memory"?
probably not, just thought I'd ask

Thanks
Mark

--------------------------------------
printout on textscreen:
(after erasing all instances of block)
DELETEBLOCK

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Failed to delete PORCH-NORTH-BEAMS-PLAN
Automation Error. Object is referenced

--------------------------------------

after closing and reopening
--------------------------------------

Command: deleteblock

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Successfully deleted PORCH-NORTH-BEAMS-PLAN

--------------------------------------


here is the deleteblock routine.
the weird function names are just my toolbox versions - hopefully
obvious
from the name what they do

(defun c:deleteblock()
(adcfLoadList
(list
'adcfGet-BlockDef
'adcfGet-ActiveDoc
))

(setq blkname "PORCH-NORTH-BEAMS-PLAN"
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"))
(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))
)
);if
(princ)
)









Back to top
Tim Decker
Guest





Posted: Fri Apr 08, 2005 12:41 am    Post subject: Re: question about accessing the "Undo memory" Reply with quote

OMG, I'm on a roll and can't get off!
(help it's a kaiser)

"Jeff Mishler" <jeff_m@cadvault.com> wrote in message
news:425588c6_1@newsprd01...
Quote:
*BZZT* Wrong answer.......

(setq blkname "PORCH-NORTH-BEAMS-PLAN"
blkobj(adcfGet-BlockDef(adcfGet-ActiveDoc) blkname )
)
The above gets the Block definition from the block table.
And the following attempts to delete it:

(vl-catch-all-apply
'vla-delete
(list blkobj)
)

--
Jeff
check out www.cadvault.com
"Tim Decker" <todecker_@_dynotecinc.com> wrote in message
news:4255873a_1@newsprd01...
According to the routine he was using, it was only deleting the
insertions of the block only. So I explained why doing that still leaves
the reference. The routine does not attempt to remove the definition at
all. I drew my conclusions from that.

"Tony Tanzillo" <tony.tanzillo@U_KNOW_WHERE.com> wrote in message
news:425584b1_2@newsprd01...
With all due respect, the poster already fully understands
the difference between a block and a block reference. I
think you may not have understood the problem he's having.

He is trying to delete the block (definition) object, when
there are no references to the block found in any layout.

Normally, AutoCAD will allow a block object to be deleted
if there are no references to it, but in this case, it isn't.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Tim Decker" <todecker_@_dynotecinc.com> wrote in message
news:42557c5a_3@newsprd01...
You are dealing with two separate things, one is the block
insertion, and the other is th block reference. The reference is a
completely separate item, so even if you erase all of the insertions,
that does not delete the reference from autocads block tables. Has
nothing to do with the undo buffer/memory. You can think of it this
way: the reference stores all of the entity information about the
block, which takes up as much space as it would to have drawn all of
the things that compose it, as well as an entry for the name of the
reference; the insertion is just treated as a single entity which calls
back to the drawing with whatever name you told it that it was supposed
to be (this saves gobs of space since the reference is the only object
that has all of the drawn entities in it). As a defense mechanism,
autocad will not let you purge a reference, unless all of the
insertions who are calling to it are erased, otherwise you would have
what they call an "undefined" block, which can cause all kinds of
problems.
Hope this explains how block references work in a drawing. External
references work on the same theory, but instead of the data about the
entities that make up the block being stored within the working
drawing, they are instead stored in an external drawing file, and then
referenced in upon loading of the working drawing.

"MP" <nospam@Thanks.com> wrote in message
news:425575d2$1_2@newsprd01...
situation:
I erase all instances of a given block
I run the following deleteblock routine.(just a temp routine to
demonstrate
the problem)

although no instances exist, the definition is still referenced

If i close and reopen the dwg the def is not referenced and it can be
purged(vla-delete)

My assumption is that the reference is contained in the "undo memory"
or
whatever that is called.

Is there any way other than closing and reopening to selectively flush
an
object from the "undo memory"?
probably not, just thought I'd ask

Thanks
Mark

--------------------------------------
printout on textscreen:
(after erasing all instances of block)
DELETEBLOCK

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Failed to delete PORCH-NORTH-BEAMS-PLAN
Automation Error. Object is referenced

--------------------------------------

after closing and reopening
--------------------------------------

Command: deleteblock

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Successfully deleted PORCH-NORTH-BEAMS-PLAN

--------------------------------------


here is the deleteblock routine.
the weird function names are just my toolbox versions - hopefully
obvious
from the name what they do

(defun c:deleteblock()
(adcfLoadList
(list
'adcfGet-BlockDef
'adcfGet-ActiveDoc
))

(setq blkname "PORCH-NORTH-BEAMS-PLAN"
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"))
(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))
)
);if
(princ)
)









Back to top
Tim Decker
Guest





Posted: Fri Apr 08, 2005 12:42 am    Post subject: Re: question about accessing the "Undo memory" Reply with quote

that what happens when you get old, and the eyes start deceiving you

"MP" <nospam@Thanks.com> wrote in message news:42558bf0$1_2@newsprd01...
Quote:
Sorry Tim,
I guess my function names aren't as self-explanatory as I thought they
were.
(adcfGet-BlockDef(adcfGet-ActiveDoc) blkname )

returns the vla-object referring to the block definition in the block
table
of the currently active document
the routine didn't actually erase any inserts
they were erased manually before running this routine
this temp routine was just demonstrating that even without insertions
there
were references being held by acad.

You're right that often times beginners confuse block refs with block
defs.
(Just happens that is one of the few things I do understand!)
:-)

Thanks for trying anyway.
Mark

"Tim Decker" <todecker_@_dynotecinc.com> wrote in message
news:4255873a_1@newsprd01...
According to the routine he was using, it was only deleting the
insertions
of the block only. So I explained why doing that still leaves the
reference. The routine does not attempt to remove the definition at all.
I
drew my conclusions from that.

"Tony Tanzillo" <tony.tanzillo@U_KNOW_WHERE.com> wrote in message
news:425584b1_2@newsprd01...
With all due respect, the poster already fully understands
the difference between a block and a block reference. I
think you may not have understood the problem he's having.

He is trying to delete the block (definition) object, when
there are no references to the block found in any layout.

Normally, AutoCAD will allow a block object to be deleted
if there are no references to it, but in this case, it isn't.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Tim Decker" <todecker_@_dynotecinc.com> wrote in message
news:42557c5a_3@newsprd01...
You are dealing with two separate things, one is the block
insertion,
and the other is th block reference. The reference is a completely
separate item, so even if you erase all of the insertions, that does
not
delete the reference from autocads block tables. Has nothing to do
with
the undo buffer/memory. You can think of it this way: the reference
stores all of the entity information about the block, which takes up
as
much space as it would to have drawn all of the things that compose
it,
as well as an entry for the name of the reference; the insertion is
just
treated as a single entity which calls back to the drawing with
whatever
name you told it that it was supposed to be (this saves gobs of space
since the reference is the only object that has all of the drawn
entities
in it). As a defense mechanism, autocad will not let you purge a
reference, unless all of the insertions who are calling to it are
erased,
otherwise you would have what they call an "undefined" block, which
can
cause all kinds of problems.
Hope this explains how block references work in a drawing.
External
references work on the same theory, but instead of the data about the
entities that make up the block being stored within the working
drawing,
they are instead stored in an external drawing file, and then
referenced
in upon loading of the working drawing.

"MP" <nospam@Thanks.com> wrote in message
news:425575d2$1_2@newsprd01...
situation:
I erase all instances of a given block
I run the following deleteblock routine.(just a temp routine to
demonstrate
the problem)

although no instances exist, the definition is still referenced

If i close and reopen the dwg the def is not referenced and it can be
purged(vla-delete)

My assumption is that the reference is contained in the "undo memory"
or
whatever that is called.

Is there any way other than closing and reopening to selectively
flush
an
object from the "undo memory"?
probably not, just thought I'd ask

Thanks
Mark

--------------------------------------
printout on textscreen:
(after erasing all instances of block)
DELETEBLOCK

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Failed to delete PORCH-NORTH-BEAMS-PLAN
Automation Error. Object is referenced

--------------------------------------

after closing and reopening
--------------------------------------

Command: deleteblock

No inserts of PORCH-NORTH-BEAMS-PLAN exist in dwg
Successfully deleted PORCH-NORTH-BEAMS-PLAN

--------------------------------------


here is the deleteblock routine.
the weird function names are just my toolbox versions - hopefully
obvious
from the name what they do

(defun c:deleteblock()
(adcfLoadList
(list
'adcfGet-BlockDef
'adcfGet-ActiveDoc
))

(setq blkname "PORCH-NORTH-BEAMS-PLAN"
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"))
(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))
)
);if
(princ)
)









Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Contact Us
Powered by phpBB