| 
×
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册 
    问题:
 
 In ObjectARX there only seems to be one function to create an AcDbXRefGraph
 of a drawing, this function is called acedGetCurDwgXRefGraph.
 
 The problem is that this only works on the current drawing!! How can I create
 an AcDbXRefGraph of an external drawing (AcDbDatabase) that I have read in?
 
 
 解答:
 
 Here is a function to do the trick.
 
 
   
// ObjectARX defined commands
#include "StdAfx.h"
#include "StdArx.h"
// function to fill in an AcDbXrefGraph with a completed graph of the current drawing's xrefs.
// Returns Acad::eOk if successful.
Acad::ErrorStatus GetXrefGraph (AcDbDatabase *dwgDb, AcDbXrefGraph& graph);
// This is command 'TEST'
void asdktest()
{
 // lock the document
 AcAxDocLock docLock;
 // now read in an external drawing
 AcDbDatabase *db = new AcDbDatabase (false);
 // if we created the db ok
 if (db != NULL)
 {
  Acad::ErrorStatus es;
  // try and read in the drawing
  es = db->readDwgFile ("c:\\temp\\114-AB1B2.dwg");
  // if ok
  if (es == Acad::eOk)
  {
   AcDbXrefGraph graph;
   // try out our new function
   GetXrefGraph (db, graph);
   // a little test to see if it worked
   acutPrintf ("\nNumber of nodes = %d", graph.numNodes ());
  } 
  delete db;
 }
}
 
 |