Notifications
Clear all

[Closed] Changing value of WPF property

Hello!

So I’ve been playing around a bit with 3dsMax ui lately, and I’ve been trying to “Hide/Show Menu Bar” through maxscript.
As you may know it’s not exposed to maxscript at all.
But I found this utility called “Snoop” that basically allows you to spy on WPF forms. I found the variable that shows/hides the menu bar.

Now I “just” need to be able to change that value through maxscript instead of “Snoop”. And since I have no idea how to go on from here, I’m just throwing it out there, maybe someone knows how to proceed from here…

Cheers,
Norman

20 Replies

Here is a little something I found…

http://through-the-interface.typepad.com/through_the_interface/2010/04/adding-to-autocads-application-menu-and-quick-access-toolbar-using-net.html

It’s also using “Autodesk.Windows.ToolBars.QuickAccessToolBarSource”

So I did some progress here…
Alex Krammer’s “Show .Net Property” tool actually can access “Autodesk.Windows.ToolBars.QuickAccessToolBarSource”.
(See screenshot)

But I’m still unable to change the property. Does anyone know why?

QAT_Toolbar = dotNetObject "Autodesk.Windows.ToolBars.QuickAccessToolBarSource"
QAT_Toolbar.IsMenuBarVisible = false

Don’t create a new toolbar, use the component manager singleton to fetch the existing one:

qatbar = (dotnetclass "Autodesk.Windows.ComponentManager").QuickAccessToolBar

qatbar.IsVisible = false
qatbar.IsMenuBarVisible = false

qatbar.IsVisible = true
qatbar.IsMenuBarVisible = true

.biddle

Of course!

Thanks a lot biddle!

So I’m just going to leave this here, in case anyone is interested. It should get rid of the InfoCenter and the QuickAccessToolbar.

ComponentManager = (dotnetclass "Autodesk.Windows.ComponentManager")

ComponentManager.QuickAccessToolBar.IsVisible = false
ComponentManager.InfoCenterToolBar.MaxWidth = 0
ComponentManager.InfoCenterToolBar.MinWidth = 0

Thanks again biddle!

Edit: It looks so much better now…

Just a quick question its a bit off topic where do you find

Autodesk.Windows etc… Assembly i dont see it in the SDK

great stuff!
thank you for permanently killing the stupid info center for me!

It isn’t documented but you can use reflection to ferret out what you need.

I typically rely on the Object Browser that comes with Visual Studio to pull in assembly files and snoop around for things that look interesting, but you can discover a lot with 3dsmax alone.

The following snippet will dump all the exported types found in the assemblies located in your max root folder.

for dllname in getfiles ((getdir #maxroot)+"*.dll") do
(
	try (
		asm = dotnet.LoadAssembly dllname
		format "
-------------------------------------------
"
		format "[%] exports:
" dllname
		for etype in (asm.GetExportedTypes()) do
		(
			format "%
" etype.FullName
		)
	)
	catch ()
)

The “Autodesk” namespace contains code that looks to be shared with (or derived from) the stuff that is in AutoCAD. Perhaps you can look there for enlightenment? link

I tried poking around adding buttons to the quick access bar & such, but it seemed kind of klunky.

.biddle

Thank you… it helped me alot. Im now looking into assemblies, could you possibly post example how you add buttons to toolbar because i made few examples since but just cant run them in max.

Page 1 / 2