- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
Developping an application, I have a problem with, I Think, the currentview.
What is needed ?
The user need to select texts in the drawing and, one after the other, these points have to be subjected to a treatment.
How do I developped the applications?
The application contents a while to know if the user pressed the escape button.
While escape is not pressed, I select the text by the following code
static public TopocomPoint PointSelection(string commandLineText)
{
TopocomPoint topocomPoint = null;
//Récupère le document courant et sa base de données
Document acDoc = Application.DocumentManager.MdiActiveDocument;
Database acCurDb = acDoc.Database;
//Récupération de l'éditeur de la base de données courante
Editor ed = acDoc.Editor;
//Démarre une nouvelle transaction
using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
{
//Création d'un filtre pour récupérer uniquement les textes
TypedValue[] acFilList = new TypedValue[1] { new TypedValue((int)DxfCode.Start, "TEXT") };
SelectionFilter acFilter = new SelectionFilter(acFilList);
PromptSelectionOptions acPSOpts = new PromptSelectionOptions();
acPSOpts.MessageForAdding = commandLineText;
acPSOpts.SingleOnly = true;
//Sélection des textes
PromptSelectionResult acPSResPoint = ed.GetSelection(acPSOpts, acFilter);
//Si la sélection a réussi
if (acPSResPoint.Status == PromptStatus.OK)
{
SelectionSet acSSetPoint = acPSResPoint.Value;
ObjectId[] acIdsPoint = acSSetPoint.GetObjectIds();
for (int i = 0; i < acIdsPoint.Length; i++)
{
//Récupération de l'objet texte saisi
DBText acTextPoint = (DBText)acTrans.GetObject(acIdsPoint[i], OpenMode.ForRead);
//Récupération des données du Texte saisi
Point3d textPoint = acTextPoint.Position;
topocomPoint = new TopocomPoint(acTextPoint.TextString.TrimStart(), 0, textPoint.X, textPoint.Y, textPoint.Z);
}
}
else if (acPSResPoint.Status == PromptStatus.Cancel)
{
//Revenir à une nouvelle ligne de commande
Autodesk.AutoCAD.Internal.Utils.PostCommandPrompt();
StopAsked = true;
}
}
return topocomPoint;
}
In that selection the user can pan, zoom, etc ... in the drawing to select a text.
returned in the while the text is treated.
The application works but that currentview problem.
What's my problem?
The ed.GetCurrentView() seems to be alway the same.
When the user zoom, pan, ... and select a text, the view return to the position at the start of the application however document, database and editor are loaded at each text selection.
What do I need to do?
If the user zoom, pan, ... and select a text, the view stay at that position when the text is selected.
What do I remarks?
ed.GetCurrentView().CenterPoint.X and .CenterPoint.Y stay the same throughout the application runs.
From my point of view, the ed.GetCurrentView() must be updated to fit with the actual drawing view.
But how to do this ?
Thanks for your advices,
JM
Solved! Go to Solution.