Autodesk ObjectARX
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Executing code in document context from other document
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
Re: Executing code in document context from other document
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
Re: Executing code in document context from other document
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I need reverse of executeInApplicationContext, like executeInDocumentContext, for synchronously running various code using acadCommand.
Re: Executing code in document context from other document
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
Re: Executing code in document context from other document
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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,endPoi
// 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
Re: Executing code in document context from other document
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
