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

Create toolbar

15 REPLIES 15
Reply
Message 1 of 16
fmarcelino
1813 Views, 15 Replies

Create toolbar

Hi,

I was wondering if is possible to create a toolbar with combos and other controls using .net. I don't want to create a toolpalette, I want a toolbar to do docking.


thanks in advance for your attention,
Filipe Marcelino
15 REPLIES 15
Message 2 of 16
Anonymous
in reply to: fmarcelino

As I know you can create toolbars only with standard combos and controls (like layer). And it will be possible with help of AutoCAD ActiveX interface.
Message 3 of 16
fmarcelino
in reply to: fmarcelino

Hi,

thanks for your answer. Can you teach me how to do it? A simple sample is enough for me.

Thanks in advance,
Filipe Marcelino
Message 4 of 16
Anonymous
in reply to: fmarcelino

[code]
// Add Reference to:
// 1) AutoCAD 200X Type Library
// 2) AutoCAD/ObjectDBX Common 1X.0 Type Library
// X = 6 or 7

using System ;
using Autodesk.AutoCAD.Runtime ;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Interop;
using Autodesk.AutoCAD.Interop.Common;

[assembly: CommandClass(typeof(Rivilis.ToolbarSample))]

namespace Rivilis
{
public class ToolbarSample
{
// Define Command "TS"
[CommandMethod("TS")]
static public void TSample()
{
try
{
IAcadApplication app =
(IAcadApplication) Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication;
IAcadMenuGroups groups = app.MenuGroups;
IAcadMenuGroup group = groups.Item(0);
IAcadToolbars toolbars = group.Toolbars;
// Adding new toolbar
IAcadToolbar toolbar = toolbars.Add("My toolbar");
// Adding button to toolbar
IAcadToolbarItem button = toolbar.AddToolbarButton(
0, // Index of button
"My button", // Name of button
"Helpstring button", // Helpstring of button
"\x1b\x1b_.OPTIONS\n", // Macro command
false // Flyout
);
// Setting path to small and large icons
button.SetBitmaps("C:\\SmallIcon.bmp","C:\\LargeIcon.bmp");
// Center toolbar on AutoCAD Window
int x = app.WindowLeft + (app.Width - toolbar.Width)/2,
y = app.WindowTop + (app.Height - toolbar.Height)/2;
toolbar.Float(y,x,1);
}
catch (System.Exception e)
{
}
}
}
}
[/code]
Message 5 of 16
Anonymous
in reply to: fmarcelino

You also have to add references to:

acdbmgd.dll
acmdg.dll

from the AutoCAD 200X folder. Works great!

Sean Campbell
Message 6 of 16
Anonymous
in reply to: fmarcelino

> You also have to add references to:
> acdbmgd.dll
> acmdg.dll
> from the AutoCAD 200X folder. Works great!
Yes. But I bore in mind that this project created with AutoCAD Managed CS Project Wizard, which add this dlls as default.
Best Regards,
Alexander Rivilis
Message 7 of 16
fmarcelino
in reply to: fmarcelino

Thanks guys, for your help. I'll try to do that. Thanks very much.

Regards,
Filipe Marcelino
Message 8 of 16
THXD
in reply to: fmarcelino

Hi all,

I was wondering if is possible to create a toolbar using .net in cad 2007. create a toolbar CAD 2005 is succes but it not work in cad 2007.


thanks in advance for your attention,
Tran Anh Binh
Ha Noi, Viet Nam
Message 9 of 16
aslam
in reply to: fmarcelino

Hi Rivilis,
I have tried your code. It is working well. But now i have two problems , plz help me.
1. I want to add a textbox in the newly created toolbar.
2. I want to give shortcut keys to added buttons.(Their macros).

Thanks.. In advance
Message 10 of 16
Anonymous
in reply to: fmarcelino

Hi, aslam!
a> 1. I want to add a textbox in the newly created toolbar.
a> 2. I want to give shortcut keys to added buttons.(Their macros).

As I know it is impossible.

Best Regards,
Alexander Rivilis.
Message 11 of 16
aslam
in reply to: fmarcelino

Why it is impossible? Actually i have seen in autocad toolbars that they have buttons, comboboxes etc. So we can not attach a textbox. The second thing is that , if it is impossible to give shorcut key to toolbar buttons. So the another way is to give shortcut key of their macro, what they are assign to? Isn't it?. So can you tell me how to assign shortcut keys to macros.
Thanks
Message 12 of 16
Anonymous
in reply to: fmarcelino

Hi, aslam!
a> Why it is impossible?
AutoCAD COM-interface allow only adding buttons and separators to toolbar.
Best Regards,
Alexander Rivilis.
Message 13 of 16
aslam
in reply to: fmarcelino

Thanks for let me know.
But how can i achive my goal now. I really needed a toolbar with 2 buttons and 1 textbox. and i aslo make them work with shortcut keys. Can anybody help me plz.
Message 14 of 16
Anonymous
in reply to: fmarcelino

It seems you're looking for your own personal help desk! Get an
ADN membership.

wrote in message news:5324205@discussion.autodesk.com...
Thanks for let me know.
But how can i achive my goal now. I really needed a toolbar with 2 buttons
and 1 textbox. and i aslo make them work with shortcut keys. Can anybody
help me plz.
Message 15 of 16
Anonymous
in reply to: fmarcelino

It is very interestiing idea! 😄
Message 16 of 16
Anonymous
in reply to: fmarcelino

brains, patients and sense of humor... 🙂
wrote in message news:5324382@discussion.autodesk.com...
It is very interestiing idea! 😄

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