.NET

Reply
Distinguished Contributor
RolandF
Posts: 172
Registered: ‎11-19-2003
Message 1 of 13 (492 Views)

Dynamic Input

492 Views, 12 Replies
05-30-2005 02:12 AM
1. Is it possible to bring some text to the curser with c# (like with the command distance), which will stay there till the cursor moves?
2. Is it possible to insert an errorsymbol at the cursor like it does the editor if you input the wrong thing?
*Albert Szilvasy
Message 2 of 13 (492 Views)

Re: Dynamic Input

05-30-2005 01:32 PM in reply to: RolandF
Can you post some screen mock-up of what you are trying to do. I'm having a
hard time to visualize this. Also look into the Editor.PointMonitor or
Editor.PointFilter event: they allow you to add a tooltip to the cursor.

Albert

wrote in message news:4859881@discussion.autodesk.com...
1. Is it possible to bring some text to the curser with c# (like with the
command distance), which will stay there till the cursor moves?
2. Is it possible to insert an errorsymbol at the cursor like it does the
editor if you input the wrong thing?
Distinguished Contributor
RolandF
Posts: 172
Registered: ‎11-19-2003
Message 3 of 13 (492 Views)

Re: Dynamic Input

05-30-2005 11:24 PM in reply to: RolandF
I attached an image which is showing what i want to do.
e.g. i want to set some values, afterwords i want to show them like acad soes with command distance.

Maybe .PointMonitor is the right way to do this, but how?

Roland
*Albert Szilvasy
Message 4 of 13 (492 Views)

Re: Dynamic Input

05-31-2005 07:19 PM in reply to: RolandF
Look at the AppendToolTipText method. It won't exactly work like the dist
command but somewhat similar.

Albert
wrote in message news:4860283@discussion.autodesk.com...
I attached an image which is showing what i want to do.
e.g. i want to set some values, afterwords i want to show them like acad
soes with command distance.

Maybe .PointMonitor is the right way to do this, but how?

Roland
Distinguished Contributor
RolandF
Posts: 172
Registered: ‎11-19-2003
Message 5 of 13 (492 Views)

Re: Dynamic Input

05-31-2005 11:36 PM in reply to: RolandF
Hi Albert,
i will look at it, but isn't it a little bit confusing that Autodesk makes a new dynamic input and says that you don't need the commandline, and on the other side it is just possible to write something in the commandline and not at the cursor with .NET!?!

Roland
Distinguished Contributor
RolandF
Posts: 172
Registered: ‎11-19-2003
Message 6 of 13 (492 Views)

Re: Dynamic Input

06-01-2005 08:21 AM in reply to: RolandF
OK, now i have to say that i have no idea how to write a text e.g. "Hello World!" with AppendToolTipText to the cursor with following code?

[code]#region Using directives

using System;
using System.Collections.Generic;
using System.Text;

using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.ApplicationServices;

#endregion

namespace RSNNAcadApp.Test
{
public class TestEditor
{
public TestEditor()
{
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
string TestString = "Hello World!";



}
}
}[/code]

Roland
*Albert Szilvasy
Message 7 of 13 (492 Views)

Re: Dynamic Input

06-01-2005 03:19 PM in reply to: RolandF
Ok. I looked at this a bit more and there really isn't any way to accomplish
what you want using supported, documented APIs. There's an undocumented API
that you can use if you are so inclined. Please see below:
#region Using directives

using System;
using System.Text;

using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.DatabaseServices;

using System.Threading;
using System.Globalization;
using System.Runtime.InteropServices;

#endregion

namespace RSNNAcadApp.Test
{
public class Test
{
//this is an undocumented api exported from acad.exe. Use it at your
own risk.
//
// Setting this flag tells AutoCAD to display the last string output
to the command line
//in the Dynamic Input prompt window (one time only.)
[DllImport("acad.exe",
EntryPoint="?acedSetDynInputDisplayMessage@@YA_N_N@Z")]
private static extern bool acedSetDynInputDisplayMessage(bool
displayMessageOnce);

private double m_dist; //last distance chosen (per-document)
private bool m_firstTime = true; //first invocation of "test"?
(per-document)
//use a non-static command method so the enclosing class (Test) will
be instantiated
//for each document
[CommandMethod("test")]
public void DoIt()
{
Editor ed =
Application.DocumentManager.MdiActiveDocument.Editor;
PromptDistanceOptions opt1 = new PromptDistanceOptions("Abstand
zeigen");

opt1.AllowNegative = false;
opt1.AllowZero = false;
opt1.AllowNone = false;
opt1.UseDashedLine = true;
if (!m_firstTime)
opt1.DefaultValue = m_dist;


PromptDoubleResult res = ed.GetDistance(opt1);

if (res.Status == PromptStatus.OK)
{
m_dist = res.Value;
ed.WriteMessage(String.Format("Abstand = {0}",
m_dist.ToString()));
acedSetDynInputDisplayMessage(true);
}
m_firstTime = false;
}
void MyPointFilter(object sender, PointFilterEventArgs e)
{
e.Result.ToolTipText = String.Format("Abstand = {0}",
m_dist.ToString());
}
}
}
wrote in message news:4861461@discussion.autodesk.com...
Hi Albert,
i will look at it, but isn't it a little bit confusing that Autodesk makes a
new dynamic input and says that you don't need the commandline, and on the
other side it is just possible to write something in the commandline and not
at the cursor with .NET!?!

Roland
Distinguished Contributor
RolandF
Posts: 172
Registered: ‎11-19-2003
Message 8 of 13 (492 Views)

Re: Dynamic Input

06-01-2005 11:33 PM in reply to: RolandF
That works great!!!
I will use it as long as it works ;-)
Do you know if there will be a chance to put this in the .NET Wrappers?
Or is it planed to put something like this in the Managed Wrapper Classes of the next Acad-Version, or better, next Service Pack? Message was edited by: RolandF
*Albert Szilvasy
Message 9 of 13 (492 Views)

Re: Dynamic Input

06-02-2005 08:11 AM in reply to: RolandF
Note that this C++ API is undocumented and unsupported. Once this API
becomes supported on the C++ API I'm pretty sure we will expose it one way
or another in the .NET API too.

Albert
wrote in message news:4862897@discussion.autodesk.com...
That works great!!!
I will use it as long as it works ;-)
Do you know if there will be a chance to put this in the .NET Wrappers?
Or is it planed to put something like this in the Managed Wrapper Classes of
the next Acad-Version, or better, next Service Pack?

Message was edited by: RolandF
Distinguished Contributor
RolandF
Posts: 172
Registered: ‎11-19-2003
Message 10 of 13 (492 Views)

Re: Dynamic Input

06-02-2005 11:40 AM in reply to: RolandF
Thank you again.

Roland
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.