As you can read in this presentation: http://aucache.autodesk.com/au2010/sessiondocuments/C/SID09823E52C525B91FD5E46817FCE482EC.pptx, fibers allows to do transparent MDI document switching. In AutoCAD 2015, there are disabled by default.
> Switching documents now:
> - Cancel all activity in previous document
> - Disables prompts (immediately return RTCAN)
So, if I've well understood your problem, your code look like this:
static Document FindInactiveDoc(Document activeDoc)
{
foreach (Document doc in Application.DocumentManager)
{
if (doc != activeDoc)
return doc;
}
return null;
}
[CommandMethod("CMD", CommandFlags.Session)]
public void Cmd()
{
Document doc1 = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc1.Editor;
ed.GetPoint("\nFirst point: ");
Document doc2 = FindInactiveDoc(doc1);
Application.DocumentManager.MdiActiveDocument = doc2;
PromptPointResult ppr = doc2.Editor.GetPoint("\nSecond point: ");
if (ppr.Status == PromptStatus.Cancel)
{
Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\nGetPoint cancelled");
return;
}
Application.DocumentManager.MdiActiveDocument = doc1;
ed.WriteMessage("\nSecond point: {0}", ppr.Value);
}
It runs perfectly on 2014, but on 2015 with fibers disabled GetPoint is cancelled.
You can rewrite it like this:
[CommandMethod("CMD1")]
public void Cmd1()
{
Document activeDoc = Application.DocumentManager.MdiActiveDocument;
Editor ed = activeDoc.Editor;
ed.GetPoint("\nFirst point: ");
Document inactiveDoc = FindInactiveDoc(activeDoc);
inactiveDoc.UserData["srcDoc"] = activeDoc;
// Pass true in activate argument to activate the document.
inactiveDoc.SendStringToExecute("CMD2\n", true, false, true);
}
[CommandMethod("CMD2")]
public void Cmd2()
{
Document activeDoc = Application.DocumentManager.MdiActiveDocument;
Editor ed = activeDoc.Editor;
PromptPointResult ppr = ed.GetPoint("\nSecond point: ");
var srcDoc = ((Document)activeDoc.UserData["srcDoc"]);
srcDoc.UserData["secPoint"] = ppr.Value;
srcDoc.SendStringToExecute("CMD3\n", true, false, true);
}
[CommandMethod("CMD3")]
public void Cmd3()
{
Document activeDoc = Application.DocumentManager.MdiActiveDocument;
Editor ed = activeDoc.Editor;
ed.WriteMessage("\nSecond point: {0}", activeDoc.UserData["secPoint"]);
}
In fact, you have to break it into 3 commands and use Document.UserData to share data between your drawings.
The MATCHPROP command works like this in 2015. There is a command PAINTPROP which is launched on the second drawing to end the processing : ftp://www.strikersystems.com/Customer/!AllanW/AutoCAD%20Longbow%20Porting%20Tips.docx
Maxence DELANNOY
Manager
Add-ins development for Autodesk software products
http://wiip.fr