sketchucation logo sketchucation
    • Login
    1. Home
    2. klap
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    K
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 5
    • Groups 1

    klap

    @klap

    10
    Reputation
    1
    Profile views
    5
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    klap Unfollow Follow
    registered-users

    Latest posts made by klap

    • RE: Why creating dictionary triggers onSelectionBulkChange?

      Thanks thomthom!

      An other question regarding SelectionObserver.onSelectionBulkChange:

      The notification seems to depend on whether I change the selection in the 3d-view or via ruby with (selection.add):
      The method onSelectionBulkChange is called only when the selection is changed in the 3d view, changing via ruby will not trigger it
      The method onSelectionCleared is triggered from the 3d-view and ruby (as expected)
      Is there a intention for that

      Is it possible to notify all registered observers via ruby (as a workaround?)?

      posted in Developers' Forum
      K
      klap
    • RE: Why creating dictionary triggers onSelectionBulkChange?

      thanks, that is clear now.
      About save points: are there other save points, beside user interaction events from javascript in the web dialog or possibly timer events.

      Is it right, that:

      • calling javascript from ruby is syncroniously
      • calling ruby from javascript is syncroniously too
        so that the following is unsave:

      rb.onSelChanged() calls js.selChanged()
      js.selChanged() calls rb.modifyModel()

      Dan, just another question regarding your former post: is it save to assume that iff the user select one entity in the 3d view, active_model.selection[0] is always this entity?
      ..

      posted in Developers' Forum
      K
      klap
    • RE: Why creating dictionary triggers onSelectionBulkChange?

      regarding my last post: ok, changing AttributeDictionary from inside the callback is also unsave, because it is a part of the model, so (1)(2)(3) are no options.
      So I have to create the AttributeDictionary asynchronously 😲

      ..
      What I am going to do is to add properties to groups to describe event triggered behaviour. E.g. to make a group being a door I annotate the group with a start and a target location. The SketchUp model is linked with a VR application which plays the game then.

      For editing the properties and interacting with the goup I use a non modal web dialog, which updates if the user changes the selection. The AttributeDictionary will be lazy created if the user press the save button in the webdialog. This works fine if I have one group per behaviour (e.g. the animation).
      Now I want to add a behaviour which switches between groups. The user interaction causes creation and associatiation of new groups. To store the associations I need a further dictionary per group which stores an "id", a "parent" and a "children" property.
      This directory must be available if the user can interact with the group via the web dialog, that means directly after the dialog has been updated caused by selecting an object by the user.
      ..

      Possibly I could work around by lazy creation triggered by certain user interactions via web dialog but would like to avoid this.

      posted in Developers' Forum
      K
      klap
    • RE: Why creating dictionary triggers onSelectionBulkChange?

      thanks for the quick reply
      what is the best/save practice in such cases: e.g. creating a attribute dictionary at an entity if the user select the entity:

      1. detaching the observer (unsave because it changes the model from inside the callback)
      2. using a flag to simulate (1)
      3. possibly skip the code in the callback if the selected Entity has not changed
      4. ?

      I am not sure what the intended behaviour after the bug fix is:
      Is the AttributeDictionary going to appear in the selection set (increasing its number)?
      Currently I assume that active_model.selection[0] is one of the Entities selected by the user, is it unsave to assume that.
      ..

      posted in Developers' Forum
      K
      klap
    • Why creating dictionary triggers onSelectionBulkChange?

      Creating a dictionary on a selected object in my onSelectionBulkChange implementation will trigger onSelectionBulkChange recursively (code and output below).
      Why does it happen? Do I have to detach the observer while editing the object?

      Thanks for your help!
      klap

      
      ..
      def onSelectionBulkChange( selection )
         puts("SelectionObserver.onSelectionBulkChange")
         puts "xxx"
         selection[0].attribute_dictionary( "test_dictionary", true )
         puts "yyy"
      end
      ..
      
      

      If I select an object once I get the following output in the Ruby-Console

      
      SelectionObserver.onSelectionBulkChange
      xxx
      SelectionObserver.onSelectionBulkChange
      xxx
      yyy
      yyy
      
      
      posted in Developers' Forum
      K
      klap