How create arrow settings?

How create arrow settings?

AndrewButenko
Advocate Advocate
1,298 Views
6 Replies
Message 1 of 7

How create arrow settings?

AndrewButenko
Advocate
Advocate

Hello!Безымянный1.png

How add arrow to panel with revit api like a picture ?

0 Likes
1,299 Views
6 Replies
Replies (6)
Message 2 of 7

Mustafa.Salaheldin
Collaborator
Collaborator

As far as I know there is now way through the Revit API. The closest approach is to create a SlideOut using AddSlideOut method.


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes
Message 3 of 7

AndrewButenko
Advocate
Advocate

Hi!

Do you have any example?

0 Likes
Message 4 of 7

Mustafa.Salaheldin
Collaborator
Collaborator

Here you are

 

index.jpg

 

private static void AddSlideOut(RibbonPanel panel)
{
    string assembly = @"D:\Sample\HelloWorld\bin\Debug\HelloWorld.dll";

    panel.AddSlideOut();

    // create some controls for the slide out
    PushButtonData b1 = new PushButtonData("ButtonName1", "Button 1",
        assembly, "Hello.HelloButton");
    b1.LargeImage = new BitmapImage(new Uri(@"path\to\your\image\32x32.png"));
    PushButtonData b2 = new PushButtonData("ButtonName2", "Button 2",
        assembly, "Hello.HelloTwo");
    b2.LargeImage = new BitmapImage(new Uri(@"path\to\your\image\16x16.png"));

    // items added after call to AddSlideOut() are added to slide-out automatically
    panel.AddItem(b1);
    panel.AddItem(b2);
}

 


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

Message 5 of 7

AndrewButenko
Advocate
Advocate

No arrow settings in this example.

0 Likes
Message 6 of 7

Mustafa.Salaheldin
Collaborator
Collaborator

@Mustafa.Salaheldin wrote:

As far as I know there is now way through the Revit API. The closest approach is to create a SlideOut using AddSlideOut method.


I was clear on that. You can't add arrow via API, but as an alternative you can use the slide out.


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes
Message 7 of 7

aignatovich
Advisor
Advisor

Hi @AndrewButenko!

 

It is not exposed in public API as @Mustafa.Salaheldin said, but that does not mean, you can't do it. There is a dark unofficial way to achieve this. You should reference AdWindows.dll and UIFramework.dll and execute something like the code below. Be careful to use Revit API in CommandHandler, you are not in safe mode at this point. You should register EventHandler and raise it. Look at Samples\ModelessDialog\ModelessForm_ExternalEvent from Revit SDK

 

 

	var tab = Autodesk.Windows.ComponentManager
		.Ribbon
		.Tabs
		.First(x => x.Title == "Manage");

	var panelSource = tab
		.Panels
		.Select(x => x.Source)
		.Single(x => x.AutomationName == "Project Location");

	var ribbonButton = new Autodesk.Windows.RibbonButton
		{
			Id = "MY_DIALOG_LAUNCHER",
			Name = "My launcher",
			Text = "My launcher title",
			IsEnabled = true,
			CommandHandler = new RelayCommand(o => true, o => MessageBox.Show("dev"))
		};
	
	panelSource.DialogLauncher = ribbonButton;

// ..... public class RelayCommand : ICommand { private readonly Predicate<object> canExecute; private readonly Action<object> execute; public RelayCommand(Predicate<object> canExecute, Action<object> execute) { this.canExecute = canExecute; this.execute = execute; } public event EventHandler CanExecuteChanged { add { CommandManager.RequerySuggested += value; } remove { CommandManager.RequerySuggested -= value; } } public bool CanExecute(object parameter) { return canExecute(parameter); } public void Execute(object parameter) { execute(parameter); } }