How To Save A Drawing Thru Proxy Object
Yes, dwgOutFields() will only save the objects data, not the class type information. I suppose this is taken from the virtual methods declared and implemented by the ACRX_DEFINE_MEMBERS / ACRX_DECLARE_MEMBERS macros. And so you would have a hard fourth dimension to change this.
Yous could endeavor to use an AcEditorReactor and implementbeginSave() and saveComplete(). In beginSave() you supplant your objects with a temporary base-form clone and in saveComplete() you switch back. To do this yous can use AcDbObject::handOverTo():
class MyEdReact : public AcEditorReactor { public: virtual void beginSave(AcDbDatabase *db, const ACHAR* pIntendedName) { AcDbObjectIdArray allMyPlines; getAllMyPlines(db, allMyPlines); // Write this yourself! int i, nCount = allMyPlines.length(); Acad::ErrorStatus es; AcDbPolyline *pline = 0; for (i = 0; i < nCount; ++i) { if ((es = acdbOpenObject(pline, allMyPlines[i], AcDb::kForWrite)) == Acad::eOk) { AcDbPolyline *plineTemp = static_cast<AcDbPolyline*>(pline->AcDbPolyline::clone()); // plineTemp->setColorIndex(1); // Merely my test es = pline->handOverTo(plineTemp); if (es == Acad::eObjectToBeDeleted) { m_TempPlines.append(plineTemp->objectId()); m_ReplacedPlines.append(pline); // don't close pLine. Store it for later plineTemp->shut(); // but this } else { delete plineTemp; // failed pline->close(); } } } } virtual void saveComplete(AcDbDatabase*, const ACHAR* pActualName) { Acad::ErrorStatus es; int i, nCount = m_ReplacedPlines.length(); for (i = 0; i<nCount; ++i) { AcDbPolyline *pline = 0; AcDbPolyline *plineBackup = 0; if ( (es=acdbOpenObject(pline, m_TempPlines[i], AcDb::kForWrite)) == Acad::eOk ) { plineBackup = static_cast<AcDbPolyline*>(m_ReplacedPlines[i]); es = pline->handOverTo(plineBackup); if (es == Acad::eObjectToBeDeleted) { delete pline; plineBackup; } else pline->close(); // failed } } m_ReplacedPlines.setLogicalLength(0); m_TempPlines.setLogicalLength(0); } private: AcDbVoidPtrArray m_ReplacedPlines; AcDbObjectIdArray m_TempPlines; };
By the way: Do yous know the AcRxOverrule classes? If you want to create portable DWGs, yous should consider to stay with the build-in classes, add your awarding data as XData, XRecord or whatsoever and apply an appropriateAcRxOverrule if you want custom behaviour.
Thomas Brammer ● Software Developer ● imos AG ● LinkedIn ●
If an respond solves your problem please [Accept SOLUTION]. Otherwise explain why not.
Source: https://forums.autodesk.com/t5/objectarx/saving-a-drawing-only-dwg-no-proxy-objects/td-p/6435095
Posted by: webbtrus1947.blogspot.com
0 Response to "How To Save A Drawing Thru Proxy Object"
Post a Comment