Notifications
Clear all

[Closed] Maxscripting the Graphite Module

Might get others started on rebuilding it the way that they like.

well, I totally agree Paul !

here’s how to execute function from the ribbon, but since I don’t use the thing, I’ll just let the task of reconstructing it to someone else


---ribbon=DotnetObject "MaxWpfContent.MaxModelingRibbonUserControl"
--ribbon.LoadRibbon()

--dotnet.loadassembly "$Max\\bin\assemblies\\MaxWpfContent.dll"
---dotnet.showConstructors "ManagedServices.MaxActionItem"
--NewActionItem=DotnetObject "ManagedServices.MaxActionItem" <ActionItem*>aActionItem

-- .[static]<ManagedServices.MaxActionItem>ResolveMacroItem <System.String>aMacroName <System.String>aMacroCategory
--- .[static]<ManagedServices.MaxActionItem>ResolveNativeItem <System.UInt32>aActionID <System.UInt32>aTableID
-- .[static]<ManagedServices.MaxActionItem>ResolveNativeItem <System.String>aActionName <System.String>aGroupName

--//--
(
dotnet.loadassembly "$Max\\ManagedServices.dll"
--//--
ActionItemResolver=Dotnetclass "ManagedServices.MaxActionItemResolver"
NewItem=ActionItemResolver.ResolveMacroItem "Convert_to_Poly" "Modifier Stack" 
NewItem.Execute()
)
--//--


Best regard,
Martin

well, I come up with this to filter the xaml file, but that not very nice … does anyone know of a better way ?


 (
 xaml_file=openfile(getdir #ui + "\\Ribbon\\ModelingRibbon.xaml")
 out_to_file=newscript()
 --//--
 while not eof xaml_file do
     (
     Compare=dotnetobject "system.string" (readline xaml_file)
     --//--
     if Compare.contains "MaxMacroRibbonButton" then 
         (
         idx_name=Compare.LastIndexOf "MacroName="
         idx_macro=Compare.LastIndexOf "MacroCategory="
         c_name=((dotnetobject "system.string" (Compare.Substring (idx_macro+15))).split "\"")[1]
         str_name=Compare.Substring (idx_name+11) (idx_macro-idx_name-13)
         --//--
         try(format ("\""+str_name+"\" \""+c_name+"\"
") to:out_to_file)catch()
         )
     --//--
     )
 --//--
 close xaml_file
 )
  

You’re right. This is not the way. I can parse the xaml and technically can change any control settings, save and reload Ribbon. New changes will appear. But what is the use? I want to do it on fly… I need only one thing – pointer to the MAX Ribbon control. And unfortunately can’t find a way to get it using MXS. But I’m keep digging…


fn parseXAML file: =
(
 if file == unsupplied do file = (getDir #ui + "Ribbon\\ModelingRibbon.xaml") 
 mReader = dotnetobject "System.Windows.Markup.XamlReader"
 xReader = dotnetclass "System.Xml.XmlReader"
 xReader = xReader.create file 
 mReader.load xReader
)

returns Ribbon Control with default MAX setting

so what you want it to add button to the existing toolbar if I understand well ?

we can call of the function of the ribbon , so just throw that away an put this in a toolbar
or something …why do we need pointer to the existing one ?

edit : thank for the reader may come andy

edit2 : ok now, I understand what you want , I’ll check this out too !

Martin

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

I can edit xaml using Microsoft Visual 2008. It’s WPF client. And it was made as WPF client. Add or remove anything is not a problem. I want to add my elements without changes in the original xaml.

if you need all macros, functions, structures, and etc. used by Graphite you can find them in Macro_PolyTools.mcr, Macro_Ribbon-Modeling.mcr, Ribbon-Modeling.ms… and global PolyBoost scructure.

You’re right. This is not the way. I can parse the xaml and technically can change any control settings, save and reload Ribbon. New changes will appear. But what is the use? I want to do it on fly… I need only one thing – pointer to the MAX Ribbon control. And unfortunately can’t find a way to get it using MXS. But I’m keep digging…

is it the pointer youre looking for ?

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

no… this is graphite window’s handle. Ribbon Control is a child of this window but Spy doesn’t see it for some reason.

ok then I’ll dig some more :rolleyes:…once you get that pointer what can you do with it from maxscript ?

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

Technically the Ribbon Control is kinda .NET control and Control.FromHandle has to return me the object (hopefully). After that I will do with it anything and everything!

ok, that what I wanted to hear , I like .Net … do you know the object that created the original so that I can start looking at the right place ?

edit : I think it’s in autodesk.windows namespace but can remember ?

sorry… I missed the point. what is your question? I know properties, methods, and constructors of Ribbon Control and other controls used by Ribbon. I can create MAX Ribbon Control and get all info that I need.

ho sorry for by bad english , I mean the ribbon constructor ??

edit : nevermind , I found it …I’ll check this out …dont know if it possible throught

Page 2 / 3