Home Technical Talk

[Maxscript] Freeform Tool Active States?

polycounter lvl 12
Offline / Send Message
jeremiah_bigley polycounter lvl 12
Hey guys!

I was looking for a way to basically check the state of, for example, the chamfer tool. I have been looking for a bit and can't seem to find anything but how to toggle them with

$.EditablePoly.ToggleCommandMode #ExtrudeEdge

Any point in a direction would be greatly appreciated! :)

JJB

Replies

  • miauu
    Options
    Offline / Send Message
    miauu polycounter lvl 14
    What do you mean by "the state of, for example, the chamfer tool"?
  • jeremiah_bigley
    Options
    Offline / Send Message
    jeremiah_bigley polycounter lvl 12
    Similar to how the Rotate Transform tool is active but I want to be able to check if the freeform chamfer tool is active.
  • jeremiah_bigley
    Options
    Offline / Send Message
    jeremiah_bigley polycounter lvl 12
    hey miauu this is what I was trying to do.
        if settingslaunch == true then
        (
            $.EditablePoly.PopupDialog #Chamfer
            settingslaunch = false
        )
    
        else
        (
            $.EditablePoly.ToggleCommandMode #chamferEdge
            settingslaunch = true
        )
    
    I just want to be able to get to the settings for a tool by hitting the same key twice, whether that is chamfer, extrude, inset, whatever.
  • miauu
    Options
    Offline / Send Message
    miauu polycounter lvl 14
    If you wan to check if the Chamfer Edges tool is active - its rollout is visible in the viewport then use this:
    (
        local desktopHWND = windows.getDesktopHWND()
        local desktopChildren = windows.getChildrenHWND desktopHWND
        local chamferUIisActive = false
        stopLoop = false
        for child in desktopChildren while stopLoop == false where (child[5] == "Chamfer Edges") do 
        (
            chamferUIisActive = true            
            stopLoop = true
        )
        format "chamferUIisActive: % \n" chamferUIisActive
    )
    
    You can use the same code for other rollouts. Just use the proper name of the desired dialog.
  • jeremiah_bigley
    Options
    Offline / Send Message
    jeremiah_bigley polycounter lvl 12
    That works great! Except it only works going from the Settings first. I would love to check if the "Tool Mode" is on.

    Script works backwards.
        local desktopHWND = windows.getDesktopHWND()
        local desktopChildren = windows.getChildrenHWND desktopHWND
        local chamferUIisActive = false
        stopLoop = false
        
        for child in desktopChildren while stopLoop == false where (child[5] == "Chamfer Edges") do 
        (
            chamferUIisActive = true            
            stopLoop = true
        )    
        
        if chamferUIisActive == false then
        (
            $.EditablePoly.PopupDialog #Chamfer
            chamferUIisActive == true
        )
        else
        (
            $.EditablePoly.ToggleCommandMode #chamferEdge
            
        )
    
    
  • jeremiah_bigley
    Options
    Offline / Send Message
    jeremiah_bigley polycounter lvl 12
    I am closer with this. I can push the button I want. Now can I check if it is toggled on?
    (
        local hwndVC = (windows.getChildHWND #max "chamfer")[5]
        UIAccessor.PressButton (windows.getChildHWND #max "chamfer")[1]
    )
    
  • miauu
    Options
    Offline / Send Message
    miauu polycounter lvl 14
    There is a way to check if a checkbox is checked or not, but for checkbuttons I can't find a way to get their states.
  • jeremiah_bigley
    Options
    Offline / Send Message
    jeremiah_bigley polycounter lvl 12
    Yeah I was seeing the same thing but couldn't find what I was looking for. Dang! Well I appreciate the help miauu! Had never messed with the UIAccessor before. Pretty cool stuff.
Sign In or Register to comment.