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

    Get/Set Image and Group glue_to ?

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 3 Posters 379 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