找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 757|回复: 2

[每日一码] Xref API 文档

[复制链接]

已领礼包: 13个

财富等级: 恭喜发财

发表于 2017-2-13 14:41:11 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
本帖最后由 LoveArx 于 2017-2-13 16:20 编辑

问题:
如何用OBJECTARX创建XREFS ?

回答:
The following function have been introduced with ObjectARX 2000:

acedXrefAttach()
acedXrefOverlay()
acedXrefUnload()
acedXrefDetach()
acedXrefReload()
acedXrefBind()
acedXrefXBind()
acedXrefCreateBlockname()

下面是帮助手册没有写入的信息。

The following information is not found in the ObjectARX Reference Manual because
they were mistakenly excluded. Here's more information on them:

Common Rules
--  All Xref APIs operate on the current document only.

--  The APIs provide document locking internally. If the document cannot be
locked they return Acad::ErrorStatus eLockViolation.

-- No input validation or range checking is done other than checking for NULL
pointers or strings. Input validation is the caller's responsibility.

--  Xref log file processing is available if option is enabled.

--  Normal AutoCAD behavior with regards to output indicators, such as, progress
meters, and msgs, may be turned off when scripts enabled && cmdecho == 0, or
menu macros enabled && menuecho == 0, or menu encryption set.

The attached sample application uses these functions to implement a set of very
simple xref commands.  Each command uses one of the Xref API functions, and very
little else, so it should be easy to see how they should be used.  Here is a
list of which sample command implements which API function:

   XRA uses acedXrefAttach()
   XRO uses acedXrefOverlay()
   XRU uses acedXrefUnload()
   XRD uses acedXrefDetach()
   XRR uses acedXrefReload()
   XRB uses acedXrefBind()
   XRI uses acedXrefBind() (with the insertBind method)



-----
Acad::ErrorStatus
acedXrefAttach(const char* XrefPathname,
const char* XrefBlockname,
AcDbObjectId* pXrefBTRid = NULL,
AcDbObjectId* pXrefRefid        = NULL,
const AcGePoint3d* pXrefInsertPt = NULL,
const AcGeScale3d*    pXrefScale = NULL,
const double* pXrefRotateAngle = NULL,
const Adesk::Boolean bQuiet = Adesk::kTrue);


Attaches an xref file to the current document.

Returns:
Returns Acad::eOk if operation is successful.

Parameters:
const char* XrefPathname [in] Xref file pathname
const char* XrefBlockname [in] Xref block name symbol to use
AcDbObjectId* pXrefBTRid [out,optional] AcDbObjectId ptr for the
attached/overlaid Xref block object Id
AcDbObjectId* pXrefRefid [out,optional] AcDbObjectId ptr for the
attached/overlaid Xref block reference object Id
const AcGePoint3d* pXrefInsertPt [in,optional] AcGePoint3d ptr for Insertion Pt
const AcGeScale3d* pXrefScale [in,optional] AcGeVector3d ptr for Scale factor
const double* pXrefRotateAngle [in, optional] double ptr for Rotate
angle(radians)
const Adesk::Boolean bQuiet [in, optional] Flag to suppress output msgs

Default behavior is as follows:
Insertion Point(X,Y,Z) = 0.0, 0.0, 0.0
Scale Factor(X,Y,Z) = 1.0, 1.0, 1.0
Rotation Angle(radians) = 0.0

-------
Acad::ErrorStatus
acedXrefOverlay(const char* XrefPathname,
const char* XrefBlockname,
AcDbObjectId* pXrefBTRid = NULL,
AcDbObjectId* pXrefRefid = NULL,
const AcGePoint3d* pXrefInsertPt = NULL,
const AcGeScale3d* pXrefScale = NULL,
const double* pXrefRotateAngle = NULL,
const Adesk::Boolean bQuiet = Adesk::kTrue);


Creates an xref overlay to the current document.

Returns:
Returns Acad::eOk if operation is successful.

Parameters:
const char* XrefPathname [in] Xref file pathname
const char* XrefBlockname [in] Xref block name symbol to use
AcDbObjectId* pXrefBTRid [out,optional] AcDbObjectId ptr for the
attached/overlaid Xref block object Id
AcDbObjectId* pXrefRefid [out,optional] AcDbObjectId ptr for the
attached/overlaid Xref block reference object Id
const AcGePoint3d* pXrefInsertPt [in,optional] AcGePoint3d ptr for Insertion Pt
const AcGeScale3d* pXrefScale [in,optional] AcGeVector3d ptr for Scale factor
const double* pXrefRotateAngle [in, optional] double ptr for Rotate
angle(radians)
const Adesk::Boolean bQuiet [in, optional] Flag to suppress output msgs

Default behavior is as follows:
Insertion Point(X,Y,Z) = 0.0, 0.0, 0.0
Scale Factor(X,Y,Z) = 1.0, 1.0, 1.0
Rotation Angle(radians) = 0.0

-----
Acad::ErrorStatus
acedXrefUnload(const char* XrefBlockname,
const Adesk::Boolean bQuiet = Adesk::kTrue);


Unloads the Xref block by its given block name. This assumes a valid Xref block
exists in the current document.

Returns:
Returns Acad::eOk if operation is successful.

Parameters:
const char* XrefBlockname [in] Xref block name symbol for unload
const Adesk::Boolean bQuiet [in,optional] Flag to suppress output msgs

----

Acad::ErrorStatus
acedXrefDetach(const char* XrefBlockname,
const Adesk::Boolean bQuiet = Adesk::kTrue);

Detaches the Xref block by its given block name. This assumes a valid Xref block
exists in the current document.

Returns:
Returns Acad::eOk if operation is successful

Parameters:
const char* XrefBlockname [in] Xref block name symbol for detach
const Adesk::Boolean bQuiet [in,optional] Flag to suppress output msgs

-------

Acad::ErrorStatus
acedXrefReload(const char* XrefBlockname,
const Adesk::Boolean bQuiet = Adesk::kTrue);


Reloads the Xref block by its given block name. This assumes a valid Xref block
exists in the current document.

Returns:
Returns Acad::eOk if operation is successful.

Parameters:
const char* XrefBlockname [in] Xref block name symbol for reload
const Adesk::Boolean bQuiet [in,optional] Flag to suppress output msgs

-------

Acad::ErrorStatus
acedXrefBind(const char* XrefBlockname,
const Adesk::Boolean bInsertBind = Adesk::kFalse,
const Adesk::Boolean bQuiet = Adesk::kTrue);


Changes the Bind type of the Xref block by its given block name. This assumes a
valid Xref block exists in the current document.

Returns:
Returns Acad::eOk if operation is successful.

Parameters:
const char* XrefBlockname [in] Xref block name symbol for bind change
const Adesk::Boolean bInsertBind [in, optional] Converts Xref symbols to
insert-like bind names.
const Adesk::Boolean bQuiet [in, optional] Flag to suppress output msgs

-----
Acad::ErrorStatus
acedXrefXBind(const AcDbObjectIdArray symbolIds,
const bool bQuiet = true);

Binds symbols from xrefs to the current drawing.

Returns:
Returns Acad::eOk if operation is successful.

Parameters:
const AcDbObjectIdArray [in] object ids of symbol table records to be bound
const Adesk::Boolean bQuiet [in, optional] Flag to suppress output msgs

-----
Acad::ErrorStatus
acedXrefCreateBlockname(const char* XrefPathname,
char*& XrefBlockname);

Accepts a Xref file pathname and returns an internally allocated block name
symbol string buffer which follows the AutoCAD policy rules for its creation.
Typically, is composed of the filename of the Xref file. A return error will
occur if the block name cannot be created. The block name string's buffer must
be released via the acutDelString().

Returns:
Returns Acad::eOk if operation is successful.

Parameters:
const char* XrefPathname [in] pointer to a Xref file pathname
char*& XrefBlockname [out] Returns a pointer to a copy of the block
name symbol string



论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!

已领礼包: 271个

财富等级: 日进斗金

发表于 2017-2-13 16:06:08 | 显示全部楼层
好资料,值得学习
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 85个

财富等级: 招财进宝

发表于 2017-2-13 17:56:06 | 显示全部楼层
支持楼主分享经验
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

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

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-11-15 05:17 , Processed in 0.370081 second(s), 31 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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