找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 28|回复: 0

arx 代码

[复制链接]

0

主题

0

回帖

26

积分

管理员

积分
26
发表于 2024-9-28 17:39:47 | 显示全部楼层 |阅读模式
// <summary> Writes members out to the drawing filer. </summary>
Acad::ErrorStatus TPG_Drawable::dwgOutFields(AcDbDwgFiler* filer) const
{
        Acad::ErrorStatus es = TPG_Object::dwgOutFields(filer);
        if (es != Acad::eOk)
                return es;

        Utilities::FilerUtilities::FileOutEntity(filer, mBody);        Utilities::FilerUtilities::FileOutEntities(filer, mEdges);
        filer->writePoint3d(mPlacement);
        filer->writeVector3d(mOffset);
        return filer->filerStatus();
}

/// <summary> Reads memebers in from the drawing filer. </summary>
Acad::ErrorStatus TPG_Drawable::dwgInFields(AcDbDwgFiler* filer)
{
        Acad::ErrorStatus es = TPG_Object::dwgInFields(filer);
        if (es != Acad::eOk)
                return es;

        Utilities::FilerUtilities::FileInEntity(filer, static_cast<AcDbEntity*&>(mBody));
        Utilities::FilerUtilities::FileInEntities(filer, mEdges);
        filer->readPoint3d(&mPlacement);
        filer->readVector3d(&mOffset);

        return filer->filerStatus();
}


/// <summary> Writes out the properties of a single entity. </summary>
static Acad::ErrorStatus FileOutEntity(AcDbDwgFiler* filer, const AcDbEntity* entity)
{
        Adesk::Boolean isDef = entity ? Adesk::kTrue : Adesk::kFalse;
        filer->writeBoolean(isDef);

        if (isDef)
        {
                AcString name = entity->isA()->name();
                filer->writeString(name);

                entity->dwgOutFields(filer);
        }
        return filer->filerStatus();
}

/// <summary> Reads in the properties of a single entity. </summary>
static Acad::ErrorStatus FileInEntity(AcDbDwgFiler* filer, AcDbEntity*& entity)
{
        if (entity)
        {
                delete entity;
                entity = nullptr;
        }

        Adesk::Boolean isDef = Adesk::kFalse;
        AcString name = L"";

        filer->readBoolean(&isDef);
        if (isDef)
        {
                filer->readString(name);
                AcRxClass* rx = static_cast<AcRxClass*>(acrxClassDictionary->at(name));

                if (rx)
                {
                        entity = static_cast<AcDbEntity*>(rx->create());
                        if (entity)
                                entity->dwgInFields(filer);
                        else
                                filer->setFilerStatus(Acad::eNotAnEntity);
                }
        }
        return filer->filerStatus();
}
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|膜结构网

GMT+8, 2024-12-27 21:39 , Processed in 0.125233 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表