sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Update | Sketchucation Tools 5.0.8 released with licensing improvements and bugfixes Download

    Update entity by webdialog/excel

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 4 Posters 620 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
      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
        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
          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
            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
              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
                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

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • 1 / 1
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement