Author Topic: DRX SDK for Public Download  (Read 5297 times)

0 Members and 1 Guest are viewing this topic.

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6942
  • AKA Daniel
DRX SDK for Public Download
« on: January 10, 2008, 11:14:12 AM »

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6942
  • AKA Daniel
Re: DRX SDK for Public Download
« Reply #1 on: January 10, 2008, 11:28:55 AM »
Here is my first attempt  :lol:

Code: [Select]
int MyLine()
{
  //In the Bricscad SDS od_doc_man.h
  OdApDocManager *pDocMan = odapDocManager();
  OdApDocument* pDoc = pDocMan->curDocument();

  // \/ \/ This is All ODA stuff  \/ \/
  //Note: this SDK like to use Smart Pointers

  //Get the Database
  OdDbDatabasePtr pDb = pDoc->database();
 
  //
  if ( pDb.isNull() )
    return (RSERR);

  //make a couple of points
  OdGePoint3d startPt(1.0, 1.0, 0.0);
  OdGePoint3d endPt(10.0, 10.0, 0.0);

  //Get the model space ID
  OdDbObjectId spaceId = pDb->getModelSpaceId();

  //Open the BTR safely :^)
  OdDbBlockTableRecordPtr pBtr = spaceId.safeOpenObject(OdDb::kForWrite);

  //Here we use the static method ::createObject() instead of instantiating the class.
  //I think this will be the norm for creating objects
  OdDbLinePtr pNewLine = OdDbLine::createObject();

  //This sets the defaults such as layer ...
  pNewLine->setDatabaseDefaults(pDb);

  //Make a couple of points
  pNewLine->setStartPoint( startPt );
  pNewLine->setEndPoint( endPt );

  //add the line
  pBtr->appendOdDbEntity(pNewLine);

  //In theory the smart pointers will clean up my mess
  return (RSRSLT);
}
« Last Edit: January 10, 2008, 12:47:49 PM by Daniel »

MickD

  • Gator
  • Posts: 3310
  • (x-in)->[process]->(y-out)
Re: DRX SDK for Public Download
« Reply #2 on: January 10, 2008, 04:19:06 PM »
Thanks Daniel, forget my q in the other thread, I'll delete it.

First impressions/thoughts??
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

Lao Tzu: To attain knowledge, add things
every day; to obtain wisdom, remove things every day.

MickD

  • Gator
  • Posts: 3310
  • (x-in)->[process]->(y-out)
Re: DRX SDK for Public Download
« Reply #3 on: January 10, 2008, 05:23:59 PM »
There's some cool stuff on the downloads page!

You never know, it may be worth developing some custom objects with this, the reason I shy away with acad is the base cost of acad to start with, the clones make it much more viable for users to acquire a good platform and plug-ins with out huge expense.
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

Lao Tzu: To attain knowledge, add things
every day; to obtain wisdom, remove things every day.

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6942
  • AKA Daniel
Re: DRX SDK for Public Download
« Reply #4 on: January 10, 2008, 09:33:30 PM »
Thanks Daniel, forget my q in the other thread, I'll delete it.

First impressions/thoughts??

Hi Mick, At first glance its a WOW! Fantastic Job ODA!  :-)

This is a giant API, so its probably going to take me a while to digest it. Its seems to have been written by a C++ purist the way everything uses smart pointers, templates etc. It also seems to be platform independent as the docs recommend separating out GUIs/Platform specific stuff to other modules. Its really very nice work

My concern, Its seems that some of the ITC members have broken off and started building their own SDKs (based off the DRX SDK) while the ITC is doing something else!?! So it remains to be seen whether or not applications written for one will be compatible for all, as SDS was. Time will tell.

All in all this is a giant step in making the once known as a Toy CAD program into a very powerful platform. And as you say, the price is right.

<yoda> Clone Wars I see in the future I do  </yoda>

MickD

  • Gator
  • Posts: 3310
  • (x-in)->[process]->(y-out)
Re: DRX SDK for Public Download
« Reply #5 on: January 10, 2008, 09:48:27 PM »
Good stuff.

About the independent sdk's, The implementors 'should' be just wrapping the DRX api to suit themselves, some to mimic as close as possible to arx for obvious reasons. I'm not that sure now a perfect copy is needed, particularly if writing new app's from scratch, a dwg file is all you need so the host isn't that important.

I just dloaded it and it looks very well done and the example of CO looks pretty straight forward.

Now, to find time to experiment ...  :roll:
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

Lao Tzu: To attain knowledge, add things
every day; to obtain wisdom, remove things every day.

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6942
  • AKA Daniel
Re: DRX SDK for Public Download
« Reply #6 on: January 11, 2008, 04:53:22 AM »
Now, to find time to experiment ...  :roll:

Mick, Do you have VS2005? When you have time to play, SHOUT, and Ill post what I have.
Of course Ill post the solution if someone else wants to play too.  ;-)

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6942
  • AKA Daniel
Re: DRX SDK for Public Download
« Reply #7 on: January 11, 2008, 06:15:35 AM »
Another sample  :-D

Code: [Select]
int GetTheGroup()
{
  sds_name entName;
  sds_point point;

  if (sds_entsel( _T("\nPick an object: ") ,entName,point) != RTNORM)
  {
     sds_printf( _T("\nError Selecting Object ") );
     return (RSERR);
  }

  sds_redraw(NULL,4); //Un-highlights everything

  //Convert sds_name to OdDbObjectId
  OdDbObjectId entId;
  if (drx_getObjectId(entId,entName) == false)
  {
    sds_printf( _T("\nI was faking it. I've been faking everything up to now. ") );
    return (RSERR);
  }


  OdDbObjectPtr pEntObject = entId.safeOpenObject(OdDb::kForRead);

  if ( pEntObject.isNull() )
    return (RSERR);

  OdDbObjectIdArray reactorIdArray;
  pEntObject->getPersistentReactors(reactorIdArray);

  for(int i = 0 ; i < reactorIdArray.length() ; i++)
  {
    OdDbGroupPtr ptr = (OdDbGroupPtr)reactorIdArray[i].safeOpenObject(OdDb::kForRead);
    sds_printf(ptr->name());
  }
 
  return (RSRSLT);
}

MickD

  • Gator
  • Posts: 3310
  • (x-in)->[process]->(y-out)
Re: DRX SDK for Public Download
« Reply #8 on: January 11, 2008, 06:44:34 AM »
Yes, I have 2005.....oh no, it's happening again....must...resist....temptation....of.....shiny object. Look away-look away :D

That's a good teaser there Daniel ;)
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

Lao Tzu: To attain knowledge, add things
every day; to obtain wisdom, remove things every day.

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6942
  • AKA Daniel
Re: DRX SDK for Public Download
« Reply #9 on: January 11, 2008, 06:55:01 AM »
Hey ya go, try this  :laugh:

I set up my windows environment as

$(DRXINC) = path to DRX 2.04 includes
$(DRXLIB) = path to DRX 2.04 VC* libs
$(BRISDS) = path to Bricscad SDS folder


Chuck Gabriel

  • Guest
Re: DRX SDK for Public Download
« Reply #10 on: January 11, 2008, 07:32:04 AM »
Yes, I have 2005.....oh no, it's happening again....must...resist....temptation....of.....shiny object. Look away-look away :D

That's a good teaser there Daniel ;)

The secret is to have so much work to do that you don't have time to play with shiny objects.

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6942
  • AKA Daniel
Re: DRX SDK for Public Download
« Reply #11 on: January 11, 2008, 02:07:00 PM »
Yes, I have 2005.....oh no, it's happening again....must...resist....temptation....of.....shiny object. Look away-look away :D

That's a good teaser there Daniel ;)

The secret is to have so much work to do that you don't have time to play with shiny objects.

Yeah, but it's hard when someone is poking you, saying lookie at what I got  :evil:

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6942
  • AKA Daniel
Re: DRX SDK for Public Download
« Reply #12 on: January 14, 2008, 05:49:25 AM »
another sample

Code: [Select]
int MakePolyline2d()
{
  //
  OdApDocManager *pDocMan = odapDocManager();
  OdApDocument* pDoc = pDocMan->curDocument();
  OdDbDatabasePtr pDb = pDoc->database();

  //
  OdDb2dPolylinePtr pNewPline = OdDb2dPolyline::createObject();

  //
  OdGePoint3dArray ptArr(4);

  //
  ptArr.append(OdGePoint3d(0.0, 0.0, 0.0));
  ptArr.append(OdGePoint3d(100.0, 0.0, 0.0));
  ptArr.append(OdGePoint3d(100.0, 100.0, 0.0));
  ptArr.append(OdGePoint3d(0.0, 100.0, 0.0));

  //
  for(int i = 0; i<ptArr.length(); i++)
  {
    OdDb2dVertexPtr pNewVertex = OdDb2dVertex::createObject();
    pNewVertex->setPosition(ptArr.getAt(i));
    pNewPline->appendVertex(pNewVertex);
  }

  //
  pNewPline->makeClosed();
  pNewPline->setDatabaseDefaults(pDb);

  //
  OdDbObjectId spaceId = pDb->getModelSpaceId();
  OdDbBlockTableRecordPtr pBtr = spaceId.safeOpenObject(OdDb::kForWrite);
  pBtr->appendOdDbEntity(pNewPline);
  return (RTNORM);
}

Chuck Gabriel

  • Guest
Re: DRX SDK for Public Download
« Reply #13 on: January 14, 2008, 07:56:19 AM »
poke!  poke!

MickD

  • Gator
  • Posts: 3310
  • (x-in)->[process]->(y-out)
Re: DRX SDK for Public Download
« Reply #14 on: January 14, 2008, 03:35:14 PM »
poke!  poke!

he he, your earlier post summed up my situation at the moment Chuck, I do have plenty to do!

Keep up the good work Daniel, the more sample code the better!
The only thing stopping me from going headlong into DRX at the moment is the lack of the d-cubed hlr engine (SOLPROF uses this) to code the 2d views engine, every thing else I need is there.
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

Lao Tzu: To attain knowledge, add things
every day; to obtain wisdom, remove things every day.

It's Alive!

  • BricsCAD
  • Needs a day job
  • Posts: 6942
  • AKA Daniel
Re: DRX SDK for Public Download
« Reply #15 on: January 15, 2008, 12:13:55 AM »
Yeah, I wont be porting apps either until the ITC releases its version 7.
I am just learning all I can while my trial version has time left  :-D