ObjectARX學習筆記

一、AutoCAD APIs支持

1,ObjectARX
2,.NET Managed API
3,COM Automation (VB, Java, Delphi, etc.)
4,AutoLISP

二次開發編程主要採用ObjectARX)和RealDWG,其中ObjectARX是免費的,RealDWG是收費的。

(http://www.autodesk.com/objectarx, 

  http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=770257)


API架構




二、ObjectARX

1,ObjectARX是什麼?

     AutoCAD Runtime eXtension

    • A DLL plug-in model
    • A set of Object Oriented C++ libraries
    • A framework

2,ObjectARX能做什麼?

  • Modify and extend the drawing database
    • Create/modify/erase objects
    • Create new types of objects
  • Modify AutoCAD’s user interface
    • Commands
    • Toolbars/dialogs
    • Properties Window
    • Design Center
    • Display system
  • Monitor/Modify AutoCAD’s standard behavior
    • Event notifications
    • Input point acquisition
3,.ARX = .DLL + 2 exported functions

  • acrxEntryPoint
  • acrxGetApiVersion

三、ObjectARX架構


AcDbDatabase 結構體系




Block Table:

三個默認的記錄:*MODEL_SPACE, *PAPER_SPACE, *PAPER_SPACE0

實體只有添加到上述三個記錄中才能在AutoCAD中顯示。


AcRxObject  (在 rxobject.h 中定義)

  • cast down-cast pointer safely
  • isA get class descriptor
  • isKindOf is object derived from?
AcDbEntity *ent;
if (ent->isKindOf( AcDbLine::desc()))
{
    AcDbLine *line = AcDbLine::cast(ent);
    //do something with line->startPoint()...
}


四、AutoCAD圖形數據庫



m

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章