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

Dynamic Input

12 REPLIES 12
Reply
Message 1 of 13
Anonymous
1551 Views, 12 Replies

Dynamic Input

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?
12 REPLIES 12
Message 2 of 13
Anonymous
in reply to: Anonymous

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?
Message 3 of 13
Anonymous
in reply to: Anonymous

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
Message 4 of 13
Anonymous
in reply to: Anonymous

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
Message 5 of 13
Anonymous
in reply to: Anonymous

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
Message 6 of 13
Anonymous
in reply to: Anonymous

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
Message 7 of 13
Anonymous
in reply to: Anonymous

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
Message 8 of 13
Anonymous
in reply to: Anonymous

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
Message 9 of 13
Anonymous
in reply to: Anonymous

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
Message 10 of 13
Anonymous
in reply to: Anonymous

Thank you again.

Roland
Message 11 of 13
Roland_Feletic
in reply to: Anonymous

Hi,

[DllImport("acad.exe", EntryPoint="?acedSetDynInputDisplayMessage@@YA_N_N@Z")]
private static extern bool acedSetDynInputDisplayMessage(bool
displayMessageOnce);

 the code Albert showed us doesn't work in AutoCAD 2013 anymore. Does anyone know if there is something new?

 

Roland

Message 12 of 13


@Roland_Feletic wrote:

the code Albert showed us doesn't work in AutoCAD 2013 anymore. Does anyone know if there is something new?


[DllImport("accore.dll", EntryPoint="?acedSetDynInputDisplayMessage@@YA_N_N@Z")]
private static extern bool acedSetDynInputDisplayMessage(bool displayMessageOnce);

 

 

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 13 of 13

Thank you again 😉

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost