ObjectARX, AutoCAD. Среда программирования библиотеки C++


Пример формирования зависимостей в объекте - часть 2


// has just been modified.

//

AcGePoint3d p = pLine->startPoint();

AcGePoint3d q = pLine->endPoint();

AcGeVector3d v = q-p;

double len = v.length();

// update other entity to match:

//

p = pLine2->startPoint();

q = pLine2->endPoint();

v = q-p;

v = len * mFactor * v.normal();

pLine2->setEndPoint(p+v);

pLine2->close();

}

}

// Files an object’s information in.

//

Acad::ErrorStatus

AsdkObjectToNotify::dwgInFields(AcDbDwgFiler* filer)

{

assertWriteEnabled();

AcDbObject::dwgInFields(filer);

filer->readItem(&mFactor);

filer->readItem((AcDbSoftPointerId*) &mId);

return filer->filerStatus();

}

 

// Files an object’s information out.

//

Acad::ErrorStatus

AsdkObjectToNotify::dwgOutFields(AcDbDwgFiler* filer) const

{

assertReadEnabled();

AcDbObject::dwgOutFields(filer);

filer->writeItem(mFactor);

filer->writeItem((AcDbSoftPointerId&)mId);

return filer->filerStatus();

}

 

// Files an object’s information in from DXF and AutoLISP.

//

Acad::ErrorStatus

AsdkObjectToNotify::dxfInFields(AcDbDxfFiler* filer)

{

assertWriteEnabled();

Acad::ErrorStatus es;

if ((es = AcDbObject::dxfInFields(filer)) != Acad::eOk)

{

return es;

}

// Check if we’re at the right subclass data marker.

//

if(!filer->atSubclassData("AsdkObjectToNotify")) {

return Acad::eBadDxfSequence;

}

struct resbuf rbIn;

while (es == Acad::eOk) {

if ((es = filer->readItem(&rbIn)) == Acad::eOk) {

if (rbIn.restype == AcDb::kDxfReal) {

mFactor = rbIn.resval.rreal;

} else if (rbIn.restype == AcDb::kDxfSoftPointerId)

{

// ObjectIds are filed in as ads_names.

//

acdbGetObjectId(mId, rbIn.resval.rlname);

} else { // invalid group

return(filer->pushBackItem());

}

}

}

return filer->filerStatus();

}

 

// Files an object’s information out to DXF and AutoLISP.

//

Acad::ErrorStatus

AsdkObjectToNotify::dxfOutFields(AcDbDxfFiler* filer) const

{

assertReadEnabled();

AcDbObject::dxfOutFields(filer);




Начало  Назад  Вперед



Книжный магазин