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

    Reliable retrieval of dynamic component attributes

    Scheduled Pinned Locked Moved Plugins
    2 Posts 2 Posters 114 Views 2 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.
    • M Offline
      mullz
      last edited by

      Hi there,

      Newbie here, trying to figure out dynamic component attributes. I'm trying to write a script that returns the name and the lenx, leny, lenz attributes of all the dynamic component instances in a model. I've got a script that works (ie it runs without error), but it doesn't return any values. It returns either empty strings or 'nil'. I've discovered that if I update the attributes of a particular instance with the 'Component Attributes' dialog, it will then return the values I have input, but only those values. Furthermore, those values don't change if I subsequently rescale the component with the scale tool.

      Also, I've noticed that if I use the set_attribute method to update an attribute, the component in question will not change in the model, but I will be able to retrieve the updated value using get_attribute.

      I've seen talk on these forums of 'redrawing' components, but there is no redraw method listed in the API. Have I missed something? Is there some way to update/refresh attributes as well as the model view? Any help would be greatly appreciated.

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

        There are some special commands for redrawing DCs that are not in the main API docs, but the DC docs and other sources...
        This has a ...
        dcs = $dc_observers.get_latest_class dcs.redraw_with_undo(sang)
        example
        http://stackoverflow.com/questions/8507476/sketchup-dynamic-component-options-manipulating-from-ruby
        Or here https://groups.google.com/forum/?fromgroups=#!topic/sketchupruby/630uerkDhJI
        There are also several posts at SCF, like this one http://sketchucation.com/forums/viewtopic.php?f=180&t=41567

        TIG

        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