zoukankan      html  css  js  c++  java
  • 读文档readarx.chm

    readarx.chm

    《Tips and Techniques》

    Incremented AutoCAD Registry Number

    Ideally, a change of registry number should have no impact on your application's code, because this number should not be hard-coded anywhere. Instead, if your application needs to know the correct registry key at runtime, you should use the appropriate APIs. ObjectARX applications (in other words, those with an .arx extension) should use the AcDbHostApplicationServices::getUserProductRegistryRootKey() and 

    AcDbHostApplicationServices::getMachineProductRegistryRootKey() function or the acrxProductKey() global function. ObjectDBX modules (in other words, those with a .dbx extension) should use the acrxObjectDBXRegistryKey() global function to get the correct registry key. These functions always return the correct registry key for the host application's version. 

     

    AcDbBlockReference的继承类不能appendAttribute(),调用为引起错误eIllegalEntityType。故意设计成这样子的。

     

    Ownership Hierarchies for Custom Objects

    In the ownership hierarchies for your custom objects, be sure to call setOwnerId() to properly establish every object's owner backpointer. A future version of AutoCAD/ObjectDBX may cease writing objects with NULL owner IDs in incremental saves.

    自定义对象要确保使用setOwnerId()方法……

    Dimension Text and Defining Point Behavior

    Dimension definition points and text position are all subject to the layout requirements of the dimension. With any of the following functions, the position passed in may be changed to fit within the layout needs of the dimension as determined by the dimension type and the current dimvar settings.

    AcDbDimension::setTextPosition()
    AcDbAlignedDimension::setDimLinePoint()
    AcDbRotatedDimension::setDimLinePoint()
    AcDb3PointAngularDimension::setArcPoint()
    AcDb2LineAngularDimension::setArcPoint()

    For example when DIMFIT = 3, for radial dimensions with the definition points such that the radial line is less than or equal to fifteen degrees from the X-axis, the text position's X coordinate can be set, but the Y coordinate will always be adjusted to locate the text along the radial line of the dimension.

    木看懂。神马意思?

    Freeing Strings Returned as Non-const Pointers

    When calling methods that return non-const string pointers (for example, AcDbSymbolTable::getName(char&* pName)), you should free the memory occupied by the returned string.

    对返回字符串指针的函数,要手动释放。

    ObjectARX Does Not Support Multi-Threaded Programming

    If you spawn multiple threads in your application, make sure that no more than one of the threads at a time invokes anything in the ObjectARX system.

    不支持多线程

    Do Not #define ACAD_OBJID_INLINE_INTERNAL

    The header files acdb.h and dbidar.h contain an #ifdef section which selects a header to #include based on ACAD_OBJID_INLINE_INTERNAL. Applications should never #define this value. There are parallel headers for the lightweight ID types, some of which are for internal AutoCAD use only. Applications that attempt to #define ACAD_OBJID_INLINE_INTERNAL will not compile successfully.

    取消定义宏ACAD_OBJID_INLINE_INTERNAL

    Remove Selections Before Aborting Transactions

    Certain interactions between transactions, the UNDO command, and the Object Property Toolbar (OPT) can put AutoCAD in an unstable condition. To avoid such situations, your ObjectARX application should always remove the pickfirst selection prior to aborting transactions, as shown here:

    acedSSSetFirst(NULL, NULL);
    actrTransactionManager->abortTransaction();
    MFC PropertySheets with ObjectARX

    Tabbed dialog boxes should use the base classes defined in the acui18.lib MFC extension DLL library. Do not use the MFC classes CPropertySheet and CPropertyPage. Use CAcUiTabMainDialog and CAcUiTabChildDialog instead. See the ObjectARX Developer's Guide and ObjectARX Reference for details.

    Using __declspec(dllimport) on Class Definitions is Hazardous

    Using the __declspec(dllimport) construct on a class exported to other applications can cause vtables to reside in all DLLs that instantiate that class. If any of these instantiating DLLs is unloaded, all instances created by that DLL become invalid. Subsequent attempts to access virtual functions on these invalid instances triggers a memory fault. 

    Consequently, the only safe way to use this directive with classes derived from AcDbObject, for example, is to mandate that no application that instantiates the class may be unloadable. To enforce this mandate, you must either document it clearly and visibly, or supply a pseudo-constructor that resides in a DLL or application that cannot be unloaded. The best policy is to avoid using this construct altogether. 

    The only exception to this warning applies if the class exports a static data member. In this case, you must use __declspec(dllimport) on that data member only, but you should avoid applying the construct to the entire class. Exporting static data members is not recommended. 

    This warning applies only to __declspec(dllimport). It does not apply to __declspec(dllexport)

    The recommended usage is as follows:

    #pragma warning( disable: 4275 4251 )
    #ifdef POLYSAMP
    #define DLLIMPEXP __declspec( dllexport )
    #else
    #define DLLIMPEXP
    #endif
    
    // The "DLLIMPEXP" is only required for exporting a poly API or using
    // the exported API.  It is not necessary for any custom classes that
    // are not exporting an API of their own.
    //
    class DLLIMPEXP AsdkPoly: public  AcDbCurve
    {
    public:
        ACRX_DECLARE_MEMBERS(AsdkPoly);
    //*****************************************************************
    // Constructors and destructor
    //*****************************************************************

     

    Standard C++ Headers and the _DEBUG Preprocessor Symbol

    If you include any of the standard C++ headers while the _DEBUG preprocessor symbol is defined, then the debug C++ runtime is forced via pragmas. (Look at use_ansi.h in Visual C++.) You don't want to use the debug C++ runtime in an ObjectARX application. 

    To avoid this, apply the following workaround:

    #ifdef _DEBUG
    #undef _DEBUG
    #endif

    挺怪的,为什么我不想?

    ----update 2013/12/5---------

    在官网提供的一个ppt里面看到的3张图解释了这个问题。

    因为ARX申请的内存空间,交付给AutoCAD后,AutoCAD会在使用结束后调用delete来释放。

    如果这些空间是申请在debug堆上,则会引起crash。

    关于debug heap,可以参考下面2处的文章。

    http://www.codeproject.com/Articles/6489/Debug-Tutorial-Part-3-The-Heap

    http://www.codeguru.com/cpp/w-p/win32/tutorials/article.php/c9535/Inside-CRT-Debug-Heap-Management.htm

    ----------------------------------

     

    Unnecessary Demand Loading Activity

    AutoCAD may occasionally demand load an application that defines a class, even when there is no object of that class in the DWG or DXF file being loaded. If you observe this and wish to prevent the unnecessary demand loading of .dbx and .arx applications, simply save the drawing in either the DWG or DXF format and then reopen the file. This procedure can be done with or without the application available. 

    Use a complete open, followed by a full save, before reloading the file.

    没看懂。Application到底是指arx还是dwg或dxf?

    ------------update 2013/12/6 ---------------

    应该是指arx。

    ------------------------------------------------

     

    AcGiGeometry::pline() Function Supports Proxy Graphics

    In previous releases, the proxy graphics DWG data structure could not handle the complexity of the pline primitive. This limitation has been addressed as of AutoCAD 2004. As a result, the AcGiGeometry::pline() function now supports the proxy graphics context.

     

     

     

  • 相关阅读:
    kmp模板
    2017 ACM/ICPC Asia Regional Shenyang Online transaction transaction transaction
    2017 ACM/ICPC Asia Regional Shenyang Online 12 card card card
    KMP
    最长不下降子序列
    codeforces round 433 D. Jury Meeting
    codeforces round 433 C. Planning 贪心
    hdu 5792 线段树+离散化+思维
    hdu 5792 树状数组+离散化+思维
    hdu 5791 思维dp
  • 原文地址:https://www.cnblogs.com/mumuliang/p/3457520.html
Copyright © 2011-2022 走看看