June 25, 2013

Hàm assertReadEnabled()

void assertReadEnabled() const;
Hàm này chỉ được sử dụng bên trong hàm thành viên của lớp dẫn xuất từ AcDbObject. Nó cần được sử dụng trong hàm thành viên để có thể truy nhập vào dữ liệu của đối tượng trong chế độ Chỉ đọc (ví dụ như hàm dxfOutFilds()). Khi sử dụng, nó phải là hàm đầu tiên được gọi tới trong hàm thành viên. Mục đích là để chắc chắn rằng đối tượng đang được mở AcDb::kForRead.
Nếu hàm được gọi khi đối tượng chưa được mở, AutoCAD sẽ chấm dứt hoạt động (cho phép người dùng ghi lại thay đổi).


void assertReadEnabled() const;
This function is used only inside of member functions of classes derived from AcDbObject. It should only be used inside of member functions that access the object's data in a read-only fashion (for example, dxfOutFields()). When used, it should be the first function called inside the member function. Its purpose is to make sure that the object is open AcDb::kForRead.
If this function is called while the object is not open, AutoCAD terminates (allowing the user to save changes).

Ví dụ:
Acad::ErrorStatus MyCustomEntity::getOsnapPoints (
    AcDb::OsnapMode osnapMode,
    int gsSelectionMark,
    const AcGePoint3d &pickPoint,
    const AcGePoint3d &lastPoint,
    const AcGeMatrix3d &viewXform,
    AcGePoint3dArray &snapPoints,
    AcDbIntArray &geomIds,
    const AcGeMatrix3d &insertionMat) const
{
    assertReadEnabled () ;
    return (AcDbEntity::getOsnapPoints (osnapMode, gsSelectionMark, pickPoint, lastPoint, viewXform, snapPoints, geomIds, insertionMat)) ;
}

No comments:

Post a Comment

Featured Post

Hướng dẫn tạo block attribute | How to convert block to Attribute block | TXT2ATT

Ứng dụng được phát triển bởi đội ngũ AutoLISP Thật là đơn giản       Thông tin thêm: 👉👉👉

Popular Posts