sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Attributes (auto updating)

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 3 Posters 990 Views 3 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.
    • medeekM Offline
      medeek
      last edited by

      I've been investigating attributes today trying to get a better handle on this aspect of SketchUp. I've noticed that the housebuilder plugin creates a category called "einfo" and stores a number of variables one of which is the "origin". If you manually move the wall group the origin attribute will automatically reflect this change in location. This is exactly the feature I need for my various assemblies (groups) so that I can add an edit feature into my own plugin. Howevever, I can't seem to figure out how this attribute is automatically updating. When I create an "origin" attribute under a "einfo" category it does not update. I must be missing something.

      Nathaniel P. Wilkerson PE
      Medeek Engineering Inc
      design.medeek.com

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

        Cross-posted:
        http://forums.sketchup.com/t/attributes-that-auto-update/27840

        (and gave answer there.)

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • medeekM Offline
          medeek
          last edited by

          Thank-you, but please read recent findings:

          Investigating this a bit more and I've found out some more interesting behavior.

          Here is the chunk of code after I create the main group that includes all of the sub-groups and sub-components:

                [highlight=#ffffff:uqexfhhl]##################################
              	#
              	# Foundation Assembly Information
          
              	@maingrouporigin = @maingroup.transformation.origin
              	@maingrouprotz = @maingroup.transformation.rotz
              	# puts @maingrouporigin @maingrouprotz
          
              	mdkinfo = 'MedeekInfo'
              	@maingroup.set_attribute mdkinfo, 'name', "FOUNDATION_ASSEMBLY_#{formatted_time}"
              	@maingroup.set_attribute mdkinfo, 'original_origin', @maingrouporigin
              	@maingroup.set_attribute mdkinfo, 'original_rotz', @maingrouprotz[/highlight:uqexfhhl]
          

          I am attempting to store the original origin and Z rotation of the group as some attributes that can be accessed at a later time. When I do this and then manually move the group the attribute "original_origin" updates to the new origin. When I manually rotate the group the attribute "original_rotz" does not update.

          I also noticed that the value from transformation.rotz is always rounded to the nearest integer value. So if my group was originally rotate 12.75 degrees, then it will store as 12 degrees.

          Nathaniel P. Wilkerson PE
          Medeek Engineering Inc
          design.medeek.com

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

            @medeek said:

            Howevever, I can't seem to figure out how this attribute is automatically updating.

            I came across some code not too long ago that could explain this - but there is no documentation for this. SketchUp seem to apply transformations to Geom::Point3d and Geom::Vector3d object stored in attributes. This might be what you want some times - other times if you don't want it, store them as arrays.

            I need to dig up that code again to remember exactly what is going on.

            (Example snippets/model of what you observe would be useful.)

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

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

              @thomthom said:

              @medeek said:

              Howevever, I can't seem to figure out how this attribute is automatically updating.

              I came across some code not too long ago that could explain this - but there is no documentation for this. SketchUp seem to apply transformations to Geom::Point3d and Geom::Vector3d object stored in attributes. This might be what you want some times - other times if you don't want it, store them as arrays.

              Which is basically what I said in the duplicate thread in the SketchUp forum, ...
              http://forums.sketchup.com/t/attributes-that-auto-update/27840

              ... which has gone beyond the original questions.

              I'm not here much anymore.

              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