项目

一般

简介

行为

错误 #248

打开

冻结图层

李立奎10 个月 之前添加.

状态:
新建
优先级:
普通
指派给:
-
开始日期:
2025-03-31
计划完成日期:
% 完成:

0%

预期时间:
#2:

描述


void FreezeLayer(AcDbLayerTable* pLayerTable
	, const ACHAR* layerName, bool frozen)
{
  // 检查图层是否存在
  if (!pLayerTable->has(layerName)) {
#ifndef NDEBUG
    acutPrintf(_T("图层 %s 不存在\n"), layerName);
#endif
    return;
  }

  AcDbLayerTableRecord* pLayerTableRecord = nullptr;

  // 打开图层记录
  if (pLayerTable->getAt(layerName, pLayerTableRecord, AcDb::kForWrite) !=
      Acad::eOk) {
#ifndef NDEBUG
    acutPrintf(_T("无法打开图层记录\n"));
#endif
    return;
  }

  // 设置图层为冻结状态
  pLayerTableRecord->setIsFrozen(frozen);

  // 关闭并释放资源
  pLayerTableRecord->close();
}

  void FreezeLayer(const ACHAR* layerName, bool frozen)
{
  AcDbLayerTable* pLayerTable = nullptr;

  // 打开图层表
  if (acdbHostApplicationServices()->workingDatabase()->getLayerTable(
        pLayerTable, AcDb::kForWrite) != Acad::eOk) {
#ifndef NDEBUG
    acutPrintf(_T("无法打开图层表\n"));
#endif
    return;
  }
  FreezeLayer(pLayerTable, layerName, frozen);
  pLayerTable->close();
}

没有任何数据可供显示

行为

导出 Atom PDF