乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 15|回复: 0

如何在Bricscad中制作表格

[复制链接]
345

1

主题

1

帖子

1

银币

初来乍到

Rank: 1

铜币
5
发表于 2008-10-20 18:25:33 | 显示全部楼层 |阅读模式
尽管 Bricscad 不支持表,但 ODA 库支持,因此可以通过 DRX 将表添加到 DWG。 Bricscad将把它画成一个方块。
  1. //++-- A sample Command class...Daniel Marcotte
  2. class CommandAddTable : public OdStaticRxObject
  3. {
  4. public:
  5.   const OdString localName() const {return globalName();}
  6.   const OdString groupName() const {return DD_T("DRXGLOBAL");}
  7.   const OdString globalName() const {return DD_T("AddTable");}
  8.   void execute(OdEdCommandContext* pCmdCtx)
  9.   {
  10.     ASSERT(pCmdCtx != NULL);
  11.     if(pCmdCtx == NULL)
  12.       return;
  13.     OdDbCommandContextPtr pDbCmdCtx(pCmdCtx);
  14.     OdDbUserIOPtr pDbIO = pDbCmdCtx->dbUserIO();
  15.     OdDbDatabasePtr pDb = pDbCmdCtx->database();
  16.     if(pDb.isNull())
  17.       return;
  18.     //++--
  19.     OdGePoint3d startPt = pDbIO->getPoint(DD_T("Get Point"));
  20.     //++-- Here we use the method ::createObject() instead of new.
  21.     OdDbTablePtr pNewTable = OdDbTable::createObject();
  22.     if(pNewTable.isNull())
  23.       return;
  24.     //++-- This sets the defaults such as layer ...
  25.     pNewTable->setDatabaseDefaults(pDb);
  26.     pNewTable->setPosition(startPt);
  27.     pNewTable->setNumColumns(5);
  28.     pNewTable->setNumRows(5);
  29.     //++-- you need to do this
  30.     pNewTable->generateLayout();
  31.     //++-- merge the top row
  32.     pNewTable->mergeCells(0,0,0,4);
  33.     pNewTable->setTextString(0,0,DD_T("Does this work"));
  34.     double textHeight = pDb->getTEXTSIZE();
  35.     pNewTable->setRowHeight(textHeight);
  36.     pNewTable->setColumnWidth(textHeight * 15);
  37.    
  38.     //++-- Get the modelspace ID
  39.     OdDbObjectId spaceId = pDb->getModelSpaceId();
  40.     if(spaceId.isNull())
  41.       return;
  42.     //++-- Open the BTR for write
  43.     OdDbBlockTableRecordPtr pBtr = spaceId.openObject(OdDb::kForWrite);
  44.     if(pBtr.isNull())
  45.       return;
  46.     //++-- add the table
  47.     pBtr->appendOdDbEntity(pNewTable);
  48.     pDbIO->putString(_T("\nDone!"));
  49.   }
  50. };


vvrr1n0sr2n.png

vvrr1n0sr2n.png

本帖以下内容被隐藏保护;需要你回复后,才能看到!

游客,如果您要查看本帖隐藏内容请回复
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-5-2 01:52 , Processed in 0.909848 second(s), 57 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表