Calling Autocad commands and typed values

Calling Autocad commands and typed values

jptallano
Enthusiast Enthusiast
1,173 Views
3 Replies
Message 1 of 4

Calling Autocad commands and typed values

jptallano
Enthusiast
Enthusiast

Hi everyone,

 

I need to send Autocad commands through C#, and so far I've been using the "acedCmd" system (I'm stuck with Autocad 2013, so I can't use the Editor.Command() method). I would like to call the MOVE command on an object that just has been created. The beginning works, I can select the object:

lastRes = acApp.DocumentManager.MdiActiveDocument.Editor.SelectLast();
rb = new ResultBuffer();
rb.Add(new TypedValue(5005, "_.MOVE"));
rb.Add(new TypedValue(5006, lastRes.Value[0].ObjectId));
(...)
acedCmd(rb.UnmanagedObject);

What I can't figure out is the (...) part, where I guess I need to programmatically emulate an "Enter" keypress (so Autocad asks for the move base point) and then provide autocad with the displacement point (using a 5002 typeValue I guess?).

How can it be done?

0 Likes
Accepted solutions (1)
1,174 Views
3 Replies
Replies (3)
Message 2 of 4

Alexander.Rivilis
Mentor
Mentor
Accepted solution

Editor.Command for previous version of AutoCAD: https://forums.autodesk.com/t5/net/send-command-executes-after-exiting-command-method/m-p/3882952#M3...

 

P.S.: Instead of _MOVE command you can use Entity.TransformBy method:

https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-NET/files/GUI...

https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-NET/files/GUI...

 

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | 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

0 Likes
Message 3 of 4

jptallano
Enthusiast
Enthusiast

Thanks a lot!

0 Likes
Message 4 of 4

dgorsman
Consultant
Consultant

In general, you should be looking to non-command call ways of doing things.  These are available for all the basic operations such as move, rotate, etc.  There are very few which require an actual command call.  Coincidentally it's also a good way of learning how things work and how to implement more complicated operations. 

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes