Named Object In NOD - Disappears?

Named Object In NOD - Disappears?

Kyudos
Advisor Advisor
3,406 Views
21 Replies
Message 1 of 22

Named Object In NOD - Disappears?

Kyudos
Advisor
Advisor

I'm adding a named object to the root NOD. ArxDbg confirms it is there after I create it. But when I save the file and reopen it, the object is no longer in the NOD. Where did it go?

 

 

0 Likes
Accepted solutions (1)
3,407 Views
21 Replies
Replies (21)
Message 2 of 22

Alexander.Rivilis
Mentor
Mentor

This object is a custom object?

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes
Message 3 of 22

Kyudos
Advisor
Advisor

Yes, I thought I might have to use hard pointers in the NOD, but that doesn't help either.

0 Likes
Message 4 of 22

Kyudos
Advisor
Advisor

ArxDbg further shows my object being erased when I save the file. What would cause that?

0 Likes
Message 5 of 22

Kyudos
Advisor
Advisor

Hmmmm.... I fixed this by adding a subErase to my object, and vetoing attempts to remove it. Why would I have to do this? Is it because I'm putting it in the NOD root, not in 'my' dictionary?

0 Likes
Message 6 of 22

artc2
Autodesk
Autodesk
There's nothing in AutoCAD that will automatically erase a generic object added to the NOD. But, if you are adding the object after a certain point in a save operation (i.e. after the handseed value has already been written to the dwg file), that can cause problems.

Another possibility would be if your object does decompose for save which could result in it being erased as part of being replaced by something else. But, if that were the case, I think you'd know about it.
0 Likes
Message 7 of 22

Kyudos
Advisor
Advisor

Thanks  - I'm storing some 'last saved' information in my object, which I set in EditorReactor::beginSave.  Is that too late? If so, where can I set it?

0 Likes
Message 8 of 22

artc2
Autodesk
Autodesk
Are you adding the object to the NOD in beginSave, or is it already added and you are are just changing its data?
0 Likes
Message 9 of 22

Kyudos
Advisor
Advisor

I create the object in the dictionary when I initialise my document. I'm doing a getAt / change data / setAt in beginSave.

 

 

0 Likes
Message 10 of 22

artc2
Autodesk
Autodesk
That shouldn't be a problem at all.

If you set up Visual Studio to use our symbol server you might be able to get call stack information that could help see what is doing the erase on save. The symbol server is http://symbols.autodesk.com/symbols
0 Likes
Message 11 of 22

Kyudos
Advisor
Advisor

Unfortunately, I get nothing:

Just:

 

Object::SubErase

[External Code]

EditorReactor::beginSave

[External Code]

0 Likes
Message 12 of 22

artc2
Autodesk
Autodesk
Are you running mixed for debug so that you can see the native as well as managed?
0 Likes
Message 13 of 22

Kyudos
Advisor
Advisor

We aren't using any managed code - just C++.

0 Likes
Message 14 of 22

artc2
Autodesk
Autodesk
Ok, then what is the version number of the AutoCAD you are using (so I can check to see if its symbols are on the symbol server)? This would be the value reported by the "_VERNUM" command or shown in the about box as the product version.
0 Likes
Message 15 of 22

Kyudos
Advisor
Advisor

It is:

 

Command: _VERNUM
_VERNUM = "Q.104.0.0 (UNICODE)" (read only)

 

Or AutoCAD 2020.1.2

0 Likes
Message 16 of 22

autodaug
Autodesk
Autodesk

Those names "Object" and "SubErase" in your stack suggest that there is managed code involved, somehow.  So it would be worth enabling managed debugging, just temporarily, to try to get more stack info.

 

I think your version of acad's symbols should be available on the server.  Here's an old post on how to get the symbols from the AutoCAD symbol server, which should still be fairly accurate.

https://through-the-interface.typepad.com/through_the_interface/2011/06/public-symbols-for-autocad-2...

 

There are a lot of symbols, and msdev has to search for them on the server via your network link. So if it is taking too long, you could change msdev to *not* automatically load *all* symbols.  And then explicitly tell it which modules' symbols to load, such as acdb24.dll and whatever other dlls you see on the stack.

 

Message 17 of 22

moogalm
Autodesk Support
Autodesk Support

Hi,

 

It appears that symbols for AutoCAD Q.104 is not updated in our upstream servers.

I will have raise a request.

 

symchk "C:\Program Files\Autodesk\AutoCAD 2020\acdb23.dll" /s srv*C:\symbols*https://symbols.autodesk.com/symbols

SYMCHK: acdb23.dll           FAILED  - acdb23.pdb mismatched or not found

SYMCHK: FAILED files = 1
SYMCHK: PASSED + IGNORED files = 0
0 Likes
Message 18 of 22

moogalm
Autodesk Support
Autodesk Support

Hi,

 

We have update debug symbols on our upstream servers https://symbols.autodesk.com/symbols

Message 19 of 22

autodaug
Autodesk
Autodesk

Great, thanks for seeing to that!

It's still a mystery why the object is being erased during a beginSave notification.  Hopefully more stack info will show us who is erasing it.  Maybe a rogue beginSave handler is doing something unintended..

0 Likes
Message 20 of 22

Kyudos
Advisor
Advisor

OK with the symbols I get:

 

acdb23.dll!AcDbImpObject::erase()	Unknown
acdb23.dll!eraseEntryObject()	Unknown
acdb23.dll!AcDbImpDictionary::setAt()	Unknown
acdb23.dll!AcDbDictionary::setAt(wchar_t const *,class AcDbObject *,class AcDbObjectId &)	Unknown
My.arx!My_EditorReactor::beginSave(AcDbDatabase * pDwg, const wchar_t * pIntendedName)

 

The erase is called by my call to setAt. Have I misunderstood how to change dictionary objects?

 

In My_EditorReactor::beginSave I have:

 

if (pDwg->getNamedObjectsDictionary(pNamedobj, AcDb::kForWrite) == Acad::eOk)
{
    MyObj* pObj = NULL;
    es = pNamedobj->getAt(_T("My_Obj"), (AcDbObject*&)pObj, AcDb::kForWrite);
    if (pObj != NULL)
    {
        pObj->SetInfo(....etc....);
        es = pNamedobj->setAt(_T("My_Obj"), pObj, DictId);
        es = pFp->close();
    }

 

Is the setAt not necessary?

0 Likes