Describing ARX, BRX, COM API..

Can someone help to put in simple words what ARX, BRX, COM API means?What are the their key importance in developing applications and what are the compatibility issues encountered relative to AutoCAD applications?

Comments

  • Sure, ARX / BRX are a set of libraries and C++ header files that allows one to create applications that extend cad’s functionality. Typically one would use a compiler such as Visual studio 2005, the API and C++ code to make applications. These APIs are the most powerful/complex and are geared for the professional programmer.The COM API or sometimes called ActiveX can be used to automate/extend cad’s functionality (Similar to how one might automate Excel or Word) . Typically one would use VBA but any COM aware language can be used. This API is less complex/ less powerful and is geared towards the power userThere is also the Lisp API, which is great for doing small scripts/applications. With Bricscad’s LispEx, which is COM aware, one can plug into the COM API as well.Bricsys is going to great lengths making sure all their APIs are compatible with AutoCAD’s so you can pick the API that best fits your application needs / skill level

  • Would you kindly provide simple example codes of programs in BRX, VBA, C++ and Lisp (this lisp is the thousands of available lisp programs fron the internet eg. http://cadtips.cadalyst.com/ correct?)I hope you'll not be suprised to learn that many users here in Malaysia are either not or only somewhat aware of Autolisp programs.There are of course a handful of users here who write some Lisp, VBA or copied from the internet, or from each other and continued to use them from there.I see the importance of educating our community here and generate the awareness of Bricscad as the platform of choice to develop any applications for our users to move forward and be more productive.There's a vast opportunity here to customise applications for our government, education and commercial consultants conforming to our building by-laws.With this introduction of COM interfaces, I can promote Briscad much, much further.Your help shall be appreciated and rewarded.

  • this lisp is the thousands of available lisp programs fron the internet eg. http://cadtips.cadalyst.com/ correct?<<<Right, those samples should work fine on Bricscad I am really not an expert in VBA so maybe someone else might be able to direct you to a sample, but here is an example of a lisp function to draw a line

    (entmake '((0 . "LINE")(10 . (0 0))(11 . (100 100))))

    A BRX function to draw a line
    static void CRPArxProject1_MyLine(void) { //++-- make a couple of points AcGePoint3d startPt(1.0, 1.0, 0.0); AcGePoint3d endPt(10.0, 10.0, 0.0); //++-- create our line AcDbLine *pLine = new AcDbLine(startPt, endPt); AcDbBlockTable *pBlockTable = NULL; AcDbBlockTableRecord* pBlockTableRecord = NULL; //++-- get a pointer to the database AcDbDatabase* pDB = acdbHostApplicationServices()->workingDatabase(); pDB->getSymbolTable(pBlockTable, AcDb::kForRead); //++-- Open the BTR for write pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite); pBlockTable->close(); //++-- add the line AcDbObjectId lineId = AcDbObjectId::kNull; pBlockTableRecord->appendAcDbEntity(lineId, pLine); pBlockTableRecord->close(); pLine->close(); }

    And a DRX function to draw a line

    class CommandAddLine : public OdStaticRxObject { public: const OdString localName() const {return globalName();} const OdString groupName() const {return DD_T("DRXGLOBAL");} const OdString globalName() const {return DD_T("AddLine");} void execute(OdEdCommandContext* pCmdCtx) { ASSERT(pCmdCtx != NULL); if(pCmdCtx == NULL) return; OdDbCommandContextPtr pDbCmdCtx(pCmdCtx); OdDbUserIOPtr pDbIO = pDbCmdCtx->dbUserIO(); //++-- get a pointer to the database OdDbDatabasePtr pDb = pDbCmdCtx->database(); if(pDb.isNull()) return; //++-- make a couple of points OdGePoint3d startPt(0.0, 0.0, 0.0); OdGePoint3d endPt(10.0, 10.0, 0.0); //++-- Here we use the method ::createObject() instead of new. OdDbLinePtr pNewLine = OdDbLine::createObject(); if(pNewLine.isNull()) return; //++-- This sets the defaults such as layer ... pNewLine->setDatabaseDefaults(pDb); //++-- add our points pNewLine->setStartPoint( startPt ); pNewLine->setEndPoint( endPt ); //++-- now we have our line setup //++-- we need to add it to the database //++-- Get the model space ID OdDbObjectId spaceId = pDb->getModelSpaceId(); if(spaceId.isNull()) return; //++-- Open the BTR for write OdDbBlockTableRecordPtr pBtr = spaceId.openObject(OdDb::kForWrite); if(pBtr.isNull()) return; //++-- add the line pBtr->appendOdDbEntity(pNewLine); pDbIO->putString(_T("\nDone!")); } };
  • Thank you Daniel for you replies.There sure are many ways to draw just one line..Let me read and perhaps contact Bricscad Support Team to seek further assistance.

  • Don't forget the advantage of LISP readability:EXAMPLE:

    ; ask user to choose points - or have function define points(setq pt1 (getpoint "Choose First Point"))(setq pt2 (getpoint "Choose Second Point")); create line using COMMAND technique(command "LINE" pt1 pt2 "")

    OR - written another way without variable creation using SETQ:

    (command "LINE" (getpoint "Choose First Point") (getpoint "Choose Second Point") "")
  • And here's one in VBA flavour ;-)Public Sub vba_DrawLine_in_V9() Dim startPoint(0 To 2) As Double Dim endPoint(0 To 2) As Double Dim myLine As AcadLine startPoint(0) = 1 startPoint(1) = 1 startPoint(2) = 0 endPoint(0) = 10 endPoint(1) = 10 endPoint(2) = 0 Set myLine = BricscadApp.ActiveDocument.ModelSpace.AddLine(startPoint, endPoint) myLine.Color = acGreen End Sub

This discussion has been closed.