How to read ribbon checkbox value with maxscript or dotnet for my custom ribbon UI.

How to read ribbon checkbox value with maxscript or dotnet for my custom ribbon UI.

sharfy
Participant Participant
1,185 Views
7 Replies
Message 1 of 8

How to read ribbon checkbox value with maxscript or dotnet for my custom ribbon UI.

sharfy
Participant
Participant

How to read ribbon checkbox value with maxscript or dotnet for my custom ribbon UI. There are some functions like OBJPaintGetSetting and VCGetSetting to read Object Paint Tab, but is no source code available for them

0 Likes
Accepted solutions (1)
1,186 Views
7 Replies
Replies (7)
Message 2 of 8

denisT.MaxDoctor
Advisor
Advisor

If you have created a custom ribbon UI, you probably have a better understanding of how to get the values. 😁

 

0 Likes
Message 3 of 8

sharfy
Participant
Participant

I just want to use MaxRibbon for my ui. not able to access spinner value or ischecked state from maxRibbon.

sharfy1_0-1706646158837.png

like object paint tools on ribbon

sharfy1_1-1706646314478.png

OBJPaintGetSetting 13
returns follow Stroke value state
Thanks

0 Likes
Message 4 of 8

denisT.MaxDoctor
Advisor
Advisor

How do you add your stuff to the ribbon? (show the code or an example)
Who can know how to read the data if we don't know how it was added?

 

I get the feeling that you are doing some hacker manipulation without understanding what or why... Your question just doesn't make sense from the point of view of how Ribbon works.

0 Likes
Message 5 of 8

trykle
Contributor
Contributor
Accepted solution

789.png

 

 

ComponentManager = dotnetclass "Autodesk.Windows.ComponentManager"
tabs = ComponentManager.Ribbon.Tabs
 
tabs.Count
tab5 = tabs.Item[4]
tab5.name
MY_CKB_1 = tab5.FindItem "MY_CKB_1"
MY_CKB_1.IsChecked

 

 

Some keywords come from Cgsociety (although it has been closed).

 

Message 6 of 8

sharfy
Participant
Participant

Thanks its working

0 Likes
Message 7 of 8

sharfy
Participant
Participant

I am adding stuff in ribbon by adding xml file in 
C:\Program Files\Autodesk\3ds Max 2023\en-US\UI\Ribbon\Extensions

file

 

<wpf:ResourceDictionary 
xmlns="clr-namespace:WPFCustomControls;assembly=WPFCustomControls"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:ads="clr-namespace:Autodesk.Windows;assembly=AdWindows"
xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:wpfcust="clr-namespace:WPFCustomControls;assembly=WPFCustomControls">

<MaxRibbonTab x:Key="Select" Title="Select" Name="Select">
<MaxModelingRibbonPanel IsAnonymous="False" IsVisible="True" ResizeStyle="NeverHideText, NeverCollapsePanel">
<MaxRibbonPanelSource Title="Select Tools">
<ads:RibbonRowPanel AllowInToolBar="false" MinWidth="100" ShowText="false" >
<ads:RibbonButton Text="Select All" ShowText="True" CommandHandler="{wpfcust:ActionItem MacroName=selectObjects, MacroCategory=test}"/>
</ads:RibbonRowPanel>
<ads:RibbonSeparator AllowInToolBar="false" MinWidth="0" ShowText="false" />
<ads:RibbonRowPanel AllowInToolBar="false" MinWidth="100" ShowText="false" >
<wpfcust:MaxRibbonCheckBox IsCheckable="true" ShowText="True" Text="shapes" Id="shp_ckb"/>
<ads:RibbonRowBreak AllowInToolBar="false" MinWidth="100" ShowText="false" />
<wpfcust:MaxRibbonCheckBox IsCheckable="true" ShowText="True" Text="geometry" Id="geo_ckb" />
</ads:RibbonRowPanel>
</MaxRibbonPanelSource>
</MaxModelingRibbonPanel>
</MaxRibbonTab> 
</wpf:ResourceDictionary>

 

 

 

 

macroScript selectObjects category:"test" tooltip:"testSel"
(
on execute do (
ComponentManager = dotnetclass "Autodesk.Windows.ComponentManager"
tabs = ComponentManager.Ribbon.Tabs
selTab = undefined
for i = 0 to tabs.count-1 do (
if tabs.Item[i].Title == "Select" then selTab = tabs.Item[i]
)
shapeCkb = selTab.FindItem "shp_ckb"
geoCkb = selTab.FindItem "geo_ckb"
if (shapeCkb.IsChecked and geoCkb.IsChecked) then (select objects)
else if shapeCkb.IsChecked then (select shapes)
else if geoCkb.IsChecked then (select geometry)
)
)

 

 

 

 

0 Likes
Message 8 of 8

denisT.MaxDoctor
Advisor
Advisor

@sharfy wrote:

I am adding stuff in ribbon by adding xml file in 
C:\Program Files\Autodesk\3ds Max 2023\en-US\UI\Ribbon\Extensions

file

 

 

<wpf:ResourceDictionary 
xmlns="clr-namespace:WPFCustomControls;assembly=WPFCustomControls"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:ads="clr-namespace:Autodesk.Windows;assembly=AdWindows"
xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:wpfcust="clr-namespace:WPFCustomControls;assembly=WPFCustomControls">

<MaxRibbonTab x:Key="Select" Title="Select" Name="Select">
<MaxModelingRibbonPanel IsAnonymous="False" IsVisible="True" ResizeStyle="NeverHideText, NeverCollapsePanel">
<MaxRibbonPanelSource Title="Select Tools">
<ads:RibbonRowPanel AllowInToolBar="false" MinWidth="100" ShowText="false" >
<ads:RibbonButton Text="Select All" ShowText="True" CommandHandler="{wpfcust:ActionItem MacroName=selectObjects, MacroCategory=test}"/>
</ads:RibbonRowPanel>
<ads:RibbonSeparator AllowInToolBar="false" MinWidth="0" ShowText="false" />
<ads:RibbonRowPanel AllowInToolBar="false" MinWidth="100" ShowText="false" >
<wpfcust:MaxRibbonCheckBox IsCheckable="true" ShowText="True" Text="shapes" Id="shp_ckb"/>
<ads:RibbonRowBreak AllowInToolBar="false" MinWidth="100" ShowText="false" />
<wpfcust:MaxRibbonCheckBox IsCheckable="true" ShowText="True" Text="geometry" Id="geo_ckb" />
</ads:RibbonRowPanel>
</MaxRibbonPanelSource>
</MaxModelingRibbonPanel>
</MaxRibbonTab> 
</wpf:ResourceDictionary>

 

 


I assumed something like that... That's not the right way to design and develop tools. It should be done through .NET methods, not by manually editing an XAML file.

0 Likes