COPYCLIP Pointer Problem - What have I done wrong?

COPYCLIP Pointer Problem - What have I done wrong?

Kyudos
Advisor Advisor
509 Views
1 Reply
Message 1 of 2

COPYCLIP Pointer Problem - What have I done wrong?

Kyudos
Advisor
Advisor

I have a parent object A that 'owns' a child object B. If I COPY or COPYCLIP A, B is correctly pulled along and copied too.

 

However, B also maintains a back-reference to A as a soft pointer. B doesn't necessarily have a parent so the pointer might be null.

 

Anyway, if B does point at A I can COPY B and everything is fine, but if I try to COPYLCLIP B while it points to A I get:

 

Error.png

 

and it is the pointer that causes this (I don't get the error if I replace the pointer with a LONG handle for instance).

 

 

So it seems I have misunderstood something relating to hard/soft pointers and their relationship to deep cloning and WBLOCK cloning.

Why does a soft pointer to an object that isn't being copied via COPYCLIP (WBLOCK?) cause the above error?

0 Likes
Accepted solutions (1)
510 Views
1 Reply
Reply (1)
Message 2 of 2

Kyudos
Advisor
Advisor
Accepted solution

Well - it seems nothing finds you the answer quite like asking the question! 🙂

 

This post with a similar issue put me on the right track:

 

I needed to allow for my pointer being invalid. In child::dwgOutFields this:

 

AcDbSoftPointerId objId = AcDbSoftPointerId(m_dbParentID);
es = pFiler->writeSoftPointerId(objId);

should have been this:

 

 

AcDbSoftPointerId objId = AcDbSoftPointerId(m_dbParentID);
if (objId.isValid())
{
    es = pFiler->writeSoftPointerId(objId);
}
else
{
    es = pFiler->writeSoftPointerId(AcDbObjectId::kNull);
}

 

0 Likes