ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Executing code in document context from other document

5 REPLIES 5
Reply
Message 1 of 6
Kari.Heinola
510 Views, 5 Replies

Executing code in document context from other document

Hello,

 

I have some old code using acedCommand and was looking to see how I can use the code without modifying it. The  code needs to be executed synchronously from application context or from other document context. Is there any other option besides doing something like: Package the input data, then put it into queue and then use sendStringToExecute to execute command that reads the data from queue the data and calls the needed functions?

 

KH

5 REPLIES 5
Message 2 of 6
Balaji_Ram
in reply to: Kari.Heinola

Hi KH,

 

Have you tried using the "acDocManagerPtr()->executeInApplicationContext" ?

This will allow you to run a piece of code in the application context.

 

If this does not help, I suggest providing more details about what you are trying.

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 3 of 6
Kari.Heinola
in reply to: Balaji_Ram

I need reverse of executeInApplicationContext, like executeInDocumentContext, for synchronously running various code using acadCommand.

Message 4 of 6
Balaji_Ram
in reply to: Kari.Heinola

If your requirement is to work on multiple documents, you can Application context command that can switch the active document based on which document it need to work on. Sorry, I dont see any other way to do it.



Balaji
Developer Technical Services
Autodesk Developer Network

Message 5 of 6
Kari.Heinola
in reply to: Balaji_Ram

I don't understand what your trying to are saying here, except that  I don't work on multiple documents. The other document context in my email was because even if our app only works with one specified document at th time, user might work on other document and issue command that should work on my document. .

 

Anyway, So I have code like the pseudo code below
  TCHAR * func1 (args,...) {
    // do something
    status = acedCommand(RTSTR, _T("_.LINE"),RT3DPOINT,startPoint,RT3DPOINT,endPoint,RTSTR, _T(""), 0);
    // do something
  }

 

This code works when executed in documen context, but acedCommand failes with -5001 when above code is executed in application context.

 

The question is how I can call the code like func1 synchronously from application context?

 

KH

 

Message 6 of 6
Balaji_Ram
in reply to: Kari.Heinola

No, I dont see any way to make that code work on another document.

 

Instead of using acedCommand, if you implement your own Application context command, you will have more control on which document you are working with.

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost