admin 发表于 2024-3-14 20:18:18

[每日一码] Xref API 文档

本帖最后由 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 Xref file pathname
const char* XrefBlockname Xref block name symbol to use
AcDbObjectId* pXrefBTRid AcDbObjectId ptr for the
attached/overlaid Xref block object Id
AcDbObjectId* pXrefRefid AcDbObjectId ptr for the
attached/overlaid Xref block reference object Id
const AcGePoint3d* pXrefInsertPt AcGePoint3d ptr for Insertion Pt
const AcGeScale3d* pXrefScale AcGeVector3d ptr for Scale factor
const double* pXrefRotateAngle double ptr for Rotate
angle(radians)
const Adesk::Boolean bQuiet 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 Xref file pathname
const char* XrefBlockname Xref block name symbol to use
AcDbObjectId* pXrefBTRid AcDbObjectId ptr for the
attached/overlaid Xref block object Id
AcDbObjectId* pXrefRefid AcDbObjectId ptr for the
attached/overlaid Xref block reference object Id
const AcGePoint3d* pXrefInsertPt AcGePoint3d ptr for Insertion Pt
const AcGeScale3d* pXrefScale AcGeVector3d ptr for Scale factor
const double* pXrefRotateAngle double ptr for Rotate
angle(radians)
const Adesk::Boolean bQuiet 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 Xref block name symbol for unload
const Adesk::Boolean bQuiet 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 Xref block name symbol for detach
const Adesk::Boolean bQuiet 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 Xref block name symbol for reload
const Adesk::Boolean bQuiet 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 Xref block name symbol for bind change
const Adesk::Boolean bInsertBind Converts Xref symbols to
insert-like bind names.
const Adesk::Boolean bQuiet 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 object ids of symbol table records to be bound
const Adesk::Boolean bQuiet 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 pointer to a Xref file pathname
char*& XrefBlockname Returns a pointer to a copy of the block
name symbol string
页: [1]
查看完整版本: [每日一码] Xref API 文档