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!
    πŸ«› Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    Get/Set Image and Group glue_to ?

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 3 Posters 408 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.
    • thomthomT Offline
      thomthom
      last edited by

      ComponentInstance has .glue_to - but Image and Group does not despite that they can be glued.
      And Face has .get_glued_instances which does list Images and Groups attached.

      Is there a workaround to glue or unglue Image or Group entities using the API?

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

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

        class Sketchup;;Group
          def real_parent
            if self.entities.parent.instances.include?(self)
              return self.entities.parent
            else
              Sketchup.active_model.definitions.each{|definition|
                return definition if definition.instances.include?(self)
              }
            end#end
            return nil # Should not happen.
          end
        end
        class Sketchup;;Image
          def real_parent
            if self.entities.parent.instances.include?(self)
              return self.entities.parent
            else
              Sketchup.active_model.definitions.each{|definition|
                return definition if definition.instances.include?(self)
              }
            end#end
            return nil # Should not happen.
          end
        end
        

        Now use these to find the 'component-instance' of a group/image - e.g. of say the group you want to 'unglue'...

        group.real_parent.instances.each{|ins|
          if ins == group
            ins.glued_to = nil
            break
          end#if
        }
        
        

        I haven't tried this but something like it should work... πŸ€“
        EDIT: tried it it fails ! πŸ˜• πŸ˜’

        TIG

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

          see new beta post, SKX forum:
          [code] beta Group/Image parent, glued_to? etc.

          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