sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Update entity by webdialog/excel

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 4 Posters 304 Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      Pout
      last edited by

      Just a question (before creating it myself):
      Is there any plugin/script/... which updates an Entity/Component/Group when it's parameters are changed in an external 'interface' (can be a webdialog or an excell sheet)

      Basically, when you update the parameters of the object by hand (type new values in a cell or input textfield) and hit a button in Sketchup the object is adapted.

      Thx in advance!

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        Parametric control?
        Dynamic Components comes close - it uses WebDialog for the UI.

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • P Offline
          Pout
          last edited by

          Indeed.
          I'm looking into DC but there's not a lot of info.
          So maybe someone already developed something like this, so I can learn from it.

          On the other hand, when I have a model in which 1 DC definition has two instances and I update on of those instances:
          framing_wall_instance = Sketchup.active_model.entities[0]
          framing_wall_definition = framing_wall_instance.definition
          ad = framing_wall_definition.attribute_dictionary "dynamic_attributes"
          ad["_lenx_formula"] = '275.447'
          $dc_observers.get_latest_class.redraw_with_undo(framing_wall_instance)

          The other one does not seem to change.
          Even more when I place an new instance in the model, it shows the 'original' component, but when placing it (click) it updates and is then equal to the edited instance.
          Probably logical but I don't see why

          1 Reply Last reply Reply Quote 0
          • TIGT Online
            TIG Moderator
            last edited by

            When you place a DC each instance is automatically made unique, so subsequently editing it won't affect the other instances.

            It IS possible to have multiple copies of DC instances [just make the copies from an instance that's already inside the SKP rather than inserting a fresh instance]: then editing one with affect all of its 'clones', but leave its [unique] siblings alone.

            If you are doing it 'in code' it is possible to give the base DC an extra 'identifying attribute' [e.g. typeCode='framing_wall'] and then your Ruby code can iterate the selection [or entities collection?] and find all DC instances that are using that matching 'identifying attribute' and processes all of them to match - thus side stepping the issue of the 'uniqueness' of the instances' definitions...

            TIG

            1 Reply Last reply Reply Quote 0
            • Dan RathbunD Offline
              Dan Rathbun
              last edited by

              Just from memory.. I believe that the DC extension uses special dictionaries at both the definition and instance level... ie, (example,) to keep specific scaling factors for the instance.

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • P Offline
                Pout
                last edited by

                a little bit more information:

                Standard DC definition attributes (dynamic_attributes):
                Retrieve with (for the selected instance):

                xx=Sketchup.active_model.selection[0].definition.attribute_dictionaries['dynamic_attributes']
                xx.each{|key,value| puts key.to_s+'-'+value.to_s}
                

                Returns (app. depending on user set attributes of the selected instance-in this case LenX and LenY are 'user cannot see' and material is 'user can see'):
                _formatversion-1.0
                _has_movetool_behaviors-0.0
                _hasbehaviors-1.0
                _lastmodified-2012-02-21 10:13
                _lengthunits-CENTIMETERS
                _lenx_access-NONE
                _lenx_formlabel-LenX
                _lenx_label-LenX
                _lenx_units-DEFAULT
                _leny_access-NONE
                _leny_formlabel-LenY
                _leny_label-LenY
                _leny_units-DEFAULT
                _material_access-VIEW
                _material_formlabel-Material
                _material_label-Material
                _material_units-STRING
                _name-Huis1
                lenx-393.700787401575
                leny-393.700787401575
                material-

                When changing LenX and LenY to 'user can see':
                _formatversion-1.0
                _has_movetool_behaviors-0.0
                _hasbehaviors-1.0
                _lastmodified-2012-02-21 10:15
                _lengthunits-CENTIMETERS
                _lenx_access-VIEW
                _lenx_formlabel-LenX
                _lenx_label-LenX
                _lenx_units-DEFAULT
                _leny_access-VIEW
                _leny_formlabel-LenY
                _leny_label-LenY
                _leny_units-DEFAULT
                _material_access-VIEW
                _material_formlabel-Material
                _material_label-Material
                _material_units-STRING
                _name-Huis1
                lenx-393.700787401575
                leny-393.700787401575
                material-

                Standard instance attributes (dynamic_attributes):

                xx=Sketchup.active_model.selection[0].attribute_dictionaries['dynamic_attributes']
                xx.each{|key,value| puts key.to_s+'-'+value.to_s}
                

                _has_movetool_behaviors-0.0
                _hasbehaviors-1.0
                lenx-393.700787401575
                leny-393.700787401575

                Now if you add an attribute on definition level eg. LenX this is accessible as lenx for both the comp. definition as the instance.
                Important: to be able to access that value on instance level with _lenx_formula (eg. to change the value) the attribute must be set to at least 'users can see this attribute' . Otherwise it cannot be changed through ruby.

                If I get out more information, I'll post it here.

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement