Explode problems

Explode problems

Anonymous
Not applicable
1,617 Views
20 Replies
Message 1 of 21

Explode problems

Anonymous
Not applicable
Hi,

I have some problems when copying using windows buffer. As I understand
autocad creates a block when ctrl+c is pressed and after ctrl+v is
pressed it copies that block into active space and explodes it. I am
copying some custom arx objects and I get a crash when exploding is
done. There are a lot of code executed during endDeepClone event
handler, it could be my mistake somewhere. As a result I get an error
message:

INTERNAL ERRORL: !insert.cpp@1646: eWasErased

I can't get call stack when the crash occurs.
Any thoughts?
0 Likes
1,618 Views
20 Replies
Replies (20)
Message 2 of 21

Anonymous
Not applicable
sounds like a document locking issue. IIRC endDeepClone executes in the app context but you can check it programmatically using AcApDocManager::isApplicationContext()
0 Likes
Message 3 of 21

Anonymous
Not applicable
AFAIK, COPYCLIP/PASTECLIP don't run in the app
context so I don't think that's it.

eWasErased would suggest an error in the OP's code,
but that's just a guess.

--
http://www.caddzone.com

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

wrote in message news:[email protected]...
sounds like a document locking issue. IIRC endDeepClone executes in the app context but you can check it programmatically using AcApDocManager::isApplicationContext()
0 Likes
Message 4 of 21

Anonymous
Not applicable
Tony Tanzillo wrote:
> eWasErased would suggest an error in the OP's code,
> but that's just a guess.

What do you mean by "OP code"? How do I solve this?

Thanks.
0 Likes
Message 5 of 21

Anonymous
Not applicable
OP = Original Poster

He's suggesting that the error is being caused by your code. It's hard to
say, since we don't have the code to look at.

The error itself, as you may have already realized, is because you are
trying to open an entity that was erased (without specifying openErased =
true). It may also be possible that you are erasing something which AutoCAD
itself subsequently tries to open. Again, it's hard to say without the code
you're running.

When does the error actually occur? Are you erasing anything? Can you
trace through the actual cloning? If this is your own custom object, try
simplifying the cloning process - cut it down until it does almost nothing,
and add pieces back in until it fails. You can try putting in reactors to
catch the deep clone, or some other event in the process - there are a lot
of options for trying to track down this error...

-Rich


"simas" wrote in message
news:[email protected]...
Tony Tanzillo wrote:
> eWasErased would suggest an error in the OP's code,
> but that's just a guess.

What do you mean by "OP code"? How do I solve this?

Thanks.
0 Likes
Message 6 of 21

Anonymous
Not applicable
Justavian wrote:
> He's suggesting that the error is being caused by your code. It's hard to
> say, since we don't have the code to look at.
>
> The error itself, as you may have already realized, is because you are
> trying to open an entity that was erased (without specifying openErased =
> true).
No this may not be, because I have handler classes for opening objects
that are configured so that I would get a message if something is wrong.

It may also be possible that you are erasing something which AutoCAD
> itself subsequently tries to open. Again, it's hard to say without the code
> you're running.

This would be more logical, because indeed I am trying to erase
something that AutoCAD could try to open subsequently.

> When does the error actually occur? Are you erasing anything? Can you
> trace through the actual cloning? If this is your own custom object, try
> simplifying the cloning process - cut it down until it does almost nothing,
> and add pieces back in until it fails. You can try putting in reactors to
> catch the deep clone, or some other event in the process - there are a lot
> of options for trying to track down this error...

Thanks for advice, I was able to reproduce this error in one of sample
ObjectARX applications. It seems that after endDeepClone() when AutoCAD
explodes (deep clone context = kDcExplode) that block (when I press
ctrl+v and position copy object) and tries to open cloned objects that
were deleted in my code in endDeepClone(). And then I get following message:

INTERNAL ERRORL: !insert.cpp@1646

I would suspect that this is AutoCAD problem.
0 Likes
Message 7 of 21

Anonymous
Not applicable
>> It seems that after endDeepClone() when AutoCAD
>> explodes (deep clone context = kDcExplode) that
>> block (when I press ctrl+v and position copy object)
>> and tries to open cloned objects that were deleted
>> in my code in endDeepClone(). And then I get
>> following message:

>> INTERNAL ERRORL: !insert.cpp@1646

>> I would suspect that this is AutoCAD problem.

Sorry, that's not an AutoCAD problem.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com
0 Likes
Message 8 of 21

Anonymous
Not applicable
Tony Tanzillo wrote:
>>> It seems that after endDeepClone() when AutoCAD
>>> explodes (deep clone context = kDcExplode) that
>>> block (when I press ctrl+v and position copy object)
>>> and tries to open cloned objects that were deleted
>>> in my code in endDeepClone(). And then I get
>>> following message:
>
>>> INTERNAL ERRORL: !insert.cpp@1646
>
>>> I would suspect that this is AutoCAD problem.
>
> Sorry, that's not an AutoCAD problem.
>

Why not?! If there is a code in my program that opens that erased object
(which is not quite possible, because I have ported this problem to
very simple sample application) I would get an error status that object
was erased. And I don't get that anywhere..

Ok, I have submitted this issue to ObjectARX support, maybe they will
tell me what's wrong.

Thanks anyway.
0 Likes
Message 9 of 21

Anonymous
Not applicable
I think the point that Tony is trying to make is that you are causing
instability in AutoCAD by deleting those cloned objects. If you were to
leave out that erase you are doing in endDeepClone(), there would be no
problem. You should consider erasing those cloned objects at a different
time. A better solution would be to prevent those objects from being cloned
in the first place, at an earlier stage in the process. You'll have to
experiment with your options.

But perhaps the support people will suggest something else...

-Rich


"simas" wrote in message
news:[email protected]...
Tony Tanzillo wrote:
>>> It seems that after endDeepClone() when AutoCAD
>>> explodes (deep clone context = kDcExplode) that
>>> block (when I press ctrl+v and position copy object)
>>> and tries to open cloned objects that were deleted
>>> in my code in endDeepClone(). And then I get
>>> following message:
>
>>> INTERNAL ERRORL: !insert.cpp@1646
>
>>> I would suspect that this is AutoCAD problem.
>
> Sorry, that's not an AutoCAD problem.
>

Why not?! If there is a code in my program that opens that erased object
(which is not quite possible, because I have ported this problem to
very simple sample application) I would get an error status that object
was erased. And I don't get that anywhere..

Ok, I have submitted this issue to ObjectARX support, maybe they will
tell me what's wrong.

Thanks anyway.
0 Likes
Message 10 of 21

Anonymous
Not applicable
Justavian wrote:
> I think the point that Tony is trying to make is that you are causing
> instability in AutoCAD by deleting those cloned objects. If you were to
> leave out that erase you are doing in endDeepClone(), there would be no
> problem. You should consider erasing those cloned objects at a different
> time. A better solution would be to prevent those objects from being cloned
> in the first place, at an earlier stage in the process. You'll have to
> experiment with your options.
>
> But perhaps the support people will suggest something else...
>
> -Rich

Good point there. Unfortunately these objects HAVE to be copied and
after erased. The issue here is why this mechanism works fine when I use
AutoCAD COPY command and doesn't work with windows COPYCLIP/PASTECLIP. I
think that if it's not legal to erase objects on endDeepClone() this
should be documented as well.
I also thought about moving that "erase objects" code somewhere else,
but it would be quite hard to implement in existing app. So here I am,
trying to solve this mystery here 🙂
0 Likes
Message 11 of 21

Anonymous
Not applicable
You're operating under a presumption that
its ok to erase cloned objects. That is not an
assumption that you can make.

When the deep clone operation is being done
by someone other than you (e.g., AutoCAD),
you cannot make assumptions about what it
may do with the cloned objects subsequently.

--
http://www.caddzone.com

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

"simas" wrote in message news:[email protected]...
Tony Tanzillo wrote:
>>> It seems that after endDeepClone() when AutoCAD
>>> explodes (deep clone context = kDcExplode) that
>>> block (when I press ctrl+v and position copy object)
>>> and tries to open cloned objects that were deleted
>>> in my code in endDeepClone(). And then I get
>>> following message:
>
>>> INTERNAL ERRORL: !insert.cpp@1646
>
>>> I would suspect that this is AutoCAD problem.
>
> Sorry, that's not an AutoCAD problem.
>

Why not?! If there is a code in my program that opens that erased object
(which is not quite possible, because I have ported this problem to
very simple sample application) I would get an error status that object
was erased. And I don't get that anywhere..

Ok, I have submitted this issue to ObjectARX support, maybe they will
tell me what's wrong.

Thanks anyway.
0 Likes
Message 12 of 21

Anonymous
Not applicable
There's really no mystery there.

Try this:

1. Add a deep clone reactor to the current
drawing's database.

2. In the endDeepClone() notification, erase
the cloned objects.

3. Start AutoCAD, load your code, and
then draw a circle.

4. Issue the MIRROR command, select the
circle, and answer yes when asked if you
want to keep the original objects, and
complete the mirror command.

AutoCAD crashes because it tries to mirror the
copies of the original objects, after they have
been erased by the deep clone reactor.

One more thing. The COPY command and the
CUT/COPYCLIP and PASTECLIP commands are
quite different. Using CUT/COPYCLIP is merely
another way of doing a WBLOCK. PASTECLIP is
just another way of doing INSERT.

--
http://www.caddzone.com

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

"simas" wrote in message news:[email protected]...
Justavian wrote:
> I think the point that Tony is trying to make is that you are causing
> instability in AutoCAD by deleting those cloned objects. If you were to
> leave out that erase you are doing in endDeepClone(), there would be no
> problem. You should consider erasing those cloned objects at a different
> time. A better solution would be to prevent those objects from being cloned
> in the first place, at an earlier stage in the process. You'll have to
> experiment with your options.
>
> But perhaps the support people will suggest something else...
>
> -Rich

Good point there. Unfortunately these objects HAVE to be copied and
after erased. The issue here is why this mechanism works fine when I use
AutoCAD COPY command and doesn't work with windows COPYCLIP/PASTECLIP. I
think that if it's not legal to erase objects on endDeepClone() this
should be documented as well.
I also thought about moving that "erase objects" code somewhere else,
but it would be quite hard to implement in existing app. So here I am,
trying to solve this mystery here 🙂
0 Likes
Message 13 of 21

Anonymous
Not applicable
Tony Tanzillo wrote:
> There's really no mystery there.
>
> Try this:
>
> 1. Add a deep clone reactor to the current
> drawing's database.
>
> 2. In the endDeepClone() notification, erase
> the cloned objects.
>
> 3. Start AutoCAD, load your code, and
> then draw a circle.
>
> 4. Issue the MIRROR command, select the
> circle, and answer yes when asked if you
> want to keep the original objects, and
> complete the mirror command.
>
> AutoCAD crashes because it tries to mirror the
> copies of the original objects, after they have
> been erased by the deep clone reactor.

Yeah, I know you're right. It's just that AutoCAD could somehow handle
this problem by leaving these objects erased and not crashing 🙂

> One more thing. The COPY command and the
> CUT/COPYCLIP and PASTECLIP commands are
> quite different. Using CUT/COPYCLIP is merely
> another way of doing a WBLOCK. PASTECLIP is
> just another way of doing INSERT.

Note: PASTECLIP is INSERT + EXPLODE 😉

Thanks for summary.
0 Likes
Message 14 of 21

Anonymous
Not applicable
>> It's just that AutoCAD could somehow handle
>> this problem by leaving these objects erased
>> and not crashing 🙂

Well, its kind of like saying it should be possible to
corrupt or change the behavior of other commands
(like MIRROR for example) and possibly cause them
to not have the intended/expected outcome or result.

I came across that one, when I wrote some code
that attempted to prevent certain objects from being
copied (because that was regarded as an error if it
was done outside the control of my app, such as
with the COPY command).

However, I quickly discovered that AutoCAD is not
architected to make vetoing of things like copy/clone
at lower levels possible, without causing all kinds of
other problems.


--
http://www.caddzone.com

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

"simas" wrote in message news:[email protected]...
Tony Tanzillo wrote:
> There's really no mystery there.
>
> Try this:
>
> 1. Add a deep clone reactor to the current
> drawing's database.
>
> 2. In the endDeepClone() notification, erase
> the cloned objects.
>
> 3. Start AutoCAD, load your code, and
> then draw a circle.
>
> 4. Issue the MIRROR command, select the
> circle, and answer yes when asked if you
> want to keep the original objects, and
> complete the mirror command.
>
> AutoCAD crashes because it tries to mirror the
> copies of the original objects, after they have
> been erased by the deep clone reactor.

> One more thing. The COPY command and the
> CUT/COPYCLIP and PASTECLIP commands are
> quite different. Using CUT/COPYCLIP is merely
> another way of doing a WBLOCK. PASTECLIP is
> just another way of doing INSERT.

Note: PASTECLIP is INSERT + EXPLODE 😉

Thanks for summary.
0 Likes
Message 15 of 21

Anonymous
Not applicable
Tony Tanzillo wrote:
>>> It's just that AutoCAD could somehow handle
>>> this problem by leaving these objects erased
>>> and not crashing 🙂
>
> Well, its kind of like saying it should be possible to
> corrupt or change the behavior of other commands
> (like MIRROR for example) and possibly cause them
> to not have the intended/expected outcome or result.

Well, I am able to create new or modify copied objects so why I
shouldn't be able to erase them in other commands ?

> I came across that one, when I wrote some code
> that attempted to prevent certain objects from being
> copied (because that was regarded as an error if it
> was done outside the control of my app, such as
> with the COPY command).
>
> However, I quickly discovered that AutoCAD is not
> architected to make vetoing of things like copy/clone
> at lower levels possible, without causing all kinds of
> other problems.

"Ha ha! Nice try" AutoCAD guys said? 🙂
0 Likes
Message 16 of 21

Anonymous
Not applicable
>> Well, I am able to create new or modify copied
>> objects so why I shouldn't be able to erase them
>> in other commands ?

I suppose the easy answer is because those commands
expect those objects to be there when they access them.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com
0 Likes
Message 17 of 21

Anonymous
Not applicable
I was merely operating under the presumption that if erasing them during the
endDeepClone() process caused instability, it could be possible to erase
those same objects at some point later. Perhaps this would require using a
short timer (i know, not the best idea), some alternate reactor, or another
method. There's always a way to make AutoCAD do what you want.

-Rich


"Tony Tanzillo" wrote in message
news:[email protected]...
You're operating under a presumption that
its ok to erase cloned objects. That is not an
assumption that you can make.

When the deep clone operation is being done
by someone other than you (e.g., AutoCAD),
you cannot make assumptions about what it
may do with the cloned objects subsequently.

--
http://www.caddzone.com

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

"simas" wrote in message
news:[email protected]...
Tony Tanzillo wrote:
>>> It seems that after endDeepClone() when AutoCAD
>>> explodes (deep clone context = kDcExplode) that
>>> block (when I press ctrl+v and position copy object)
>>> and tries to open cloned objects that were deleted
>>> in my code in endDeepClone(). And then I get
>>> following message:
>
>>> INTERNAL ERRORL: !insert.cpp@1646
>
>>> I would suspect that this is AutoCAD problem.
>
> Sorry, that's not an AutoCAD problem.
>

Why not?! If there is a code in my program that opens that erased object
(which is not quite possible, because I have ported this problem to
very simple sample application) I would get an error status that object
was erased. And I don't get that anywhere..

Ok, I have submitted this issue to ObjectARX support, maybe they will
tell me what's wrong.

Thanks anyway.
0 Likes
Message 18 of 21

Anonymous
Not applicable
Why do the objects HAVE to be copied and then deleted?

-Rich


"simas" wrote in message
news:[email protected]...
Justavian wrote:
> I think the point that Tony is trying to make is that you are causing
> instability in AutoCAD by deleting those cloned objects. If you were to
> leave out that erase you are doing in endDeepClone(), there would be no
> problem. You should consider erasing those cloned objects at a different
> time. A better solution would be to prevent those objects from being
> cloned
> in the first place, at an earlier stage in the process. You'll have to
> experiment with your options.
>
> But perhaps the support people will suggest something else...
>
> -Rich

Good point there. Unfortunately these objects HAVE to be copied and
after erased. The issue here is why this mechanism works fine when I use
AutoCAD COPY command and doesn't work with windows COPYCLIP/PASTECLIP. I
think that if it's not legal to erase objects on endDeepClone() this
should be documented as well.
I also thought about moving that "erase objects" code somewhere else,
but it would be quite hard to implement in existing app. So here I am,
trying to solve this mystery here 🙂
0 Likes
Message 19 of 21

Anonymous
Not applicable
I will not get into details, the problem is we are working on huge
project where there is a huge pile of unstructured code that is hard to
read and control. It's done so that these objects have to be deleted and
recreated, and changing this logic would result in large amount of time
resources waisted.

I have already solved this problem by deleting these objects during
commandEnded() event handler when PASTECLIP ends.

Thanks for help Tony and Justavian. Looks like there is a place online
where people actually discuss about ObjectARX and AutoCAD 🙂

Justavian wrote:
> Why do the objects HAVE to be copied and then deleted?
>
> -Rich
0 Likes
Message 20 of 21

Anonymous
Not applicable
Good work - that's the kind of point i was trying to get across in one of my
other posts. You can always get AutoCAD to do what you want. It might not
always be the method you had intended, and it might not always be the most
elegant solution, but you can always bend it to your will!

-Rich


"simas" wrote in message
news:[email protected]...
I will not get into details, the problem is we are working on huge
project where there is a huge pile of unstructured code that is hard to
read and control. It's done so that these objects have to be deleted and
recreated, and changing this logic would result in large amount of time
resources waisted.

I have already solved this problem by deleting these objects during
commandEnded() event handler when PASTECLIP ends.

Thanks for help Tony and Justavian. Looks like there is a place online
where people actually discuss about ObjectARX and AutoCAD 🙂

Justavian wrote:
> Why do the objects HAVE to be copied and then deleted?
>
> -Rich
0 Likes