TBC Macros and Extensions

 View Only
Expand all | Collapse all

correct use of Trimble.Vce.UI.Controls.InputSettings ?

  • 1.  correct use of Trimble.Vce.UI.Controls.InputSettings ?

    Posted 10-01-2024 23:21

    In the other post I claimed that setting/changing the snap modes does work. That was a bit premature.

    I'm able to retrieve the current active snap modes and I'm able to write back a changed list.

    self.snaplist = InputSettings.GetSnapModes(self.currentProject.Guid) # order/priority and enabled/disabled of snap modes
    
    # do some changes to the list
    
    InputSettings.SaveSnapModes(self.currentProject.Guid, self.snaplist)

    And I can see the changes in the usual Snap Window,

    BUT they don't take effect until I click the OK button in that window, which currently renders the macro useless.

    I guess I somehow need to force the project to reload those settings?



    ------------------------------
    Ronny Schneider
    ------------------------------


  • 2.  RE: correct use of Trimble.Vce.UI.Controls.InputSettings ?
    Best Answer

    Posted 10-07-2024 14:17

    Hi Ronny,

    Can you also try setting the `InputSettings.RunningSnaps` property at the end of your SaveSnapModes. It should be an array of the enabled snaps. 



    ------------------------------
    Bryce Haire
    ------------------------------



  • 3.  RE: correct use of Trimble.Vce.UI.Controls.InputSettings ?

    Posted 10-07-2024 14:18

    Also, if all are disabled, please set the value:

    new Trimble.Vce.Interfaces.SnapIn.SnapMode[] { Trimble.Vce.Interfaces.SnapIn.SnapMode.None }

    and not an empty array. 



    ------------------------------
    Bryce Haire
    ------------------------------



  • 4.  RE: correct use of Trimble.Vce.UI.Controls.InputSettings ?

    Posted 10-07-2024 17:48

    Thanks for that Bryce,

    that made it work.

    I had played around with InputSettings.RunningSnaps as well, but only looked for changes in the menu.

    In fact, if you only want to change the snap modes and don't care about having the menu UpToDate then you only need to set InputSettings.RunningSnaps.

    But if you want both to match then you'll have to set

    InputSettings.SaveSnapModes

    • which requires a 13-element array of unsigned Int16; Array[UInt16]([UInt16()] * 13)
    • 0 = point
      1 = end
      2 = mid
      3 = near
      4 = center
      5 = insertion
      7 = perp
      8 = tangent
      9 = node
      11 = intersection
      12 = free
      19 = quad
      20 = image
    • if you add 4096 to the integer it's being ticked in the menu
    • if you change the order, it changes the priority

    InputSettings.RunningSnaps

    • requires an Array with the size of ticked snapmodes
    • means first you need to know how many snaps will be ticked; i.e. self.snapstickedarray = Array[SnapMode]([SnapMode(13)] * snapsticked.Count)
    • setting all the snap modes to None and then loop through again and set the snap mode based on an integer; self.snapstickedarray[i] = SnapMode(snapsticked[i])

    That simple idea turned into a very cumbersome ordeal again.

    When will we finally get a decent SDK documentation. The macro language came out and is being advertised since 2018. After 6 years we still have basically no documentation.



    ------------------------------
    Ronny Schneider
    ------------------------------