sketchucation logo sketchucation
    • Login
    1. Home
    2. themonty
    3. Posts
    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
    T
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 3
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: The component information inside the group extract

      Thank you for your help.
      It works perfectly.
      Thank you again.

      posted in Developers' Forum
      T
      themonty
    • RE: The component information inside the group extract

      Thank you for your answer.
      As you execute the code you sent, Error: #SystemStackError: stack level too deep]
      There's a message.

      I will upload the sketchup file.

      I want to extract the name of the Component Instance Definition in each group.


      Bug_2.skp

      posted in Developers' Forum
      T
      themonty
    • The component information inside the group extract

      Hello, I'm a beginner in Ruby's development.
      We are currently developing a Ruby to extract component information within the group.
      The component information inside the group is extracted, but the component information within the group and within the group cannot be extracted.
      Is there a way to continue searching for a child group by applying a repeat statement to get some component information?

      code :

      sel.each do |ss|
        if not ss.class == Sketchup;;Group
          UI.messagebox ('๊ทธ๋ฃน์„ ์„ ํƒํ•ด ์ฃผ์„ธ์š”')
          return
        end
        #@group_names.push(ss.name)
        #@num_entities.push(ss.entities.length)
      
        #๊ฐ ์ธ์Šคํ„ด์Šค ๋ณ„ Definition ์ด๋ฆ„์„ @name ๋ฐฐ์—ด์— ๋„ฃ๋Š”๋‹ค.
        ss.entities.each do |e|
          if e.class == Sketchup;;ComponentInstance
            if e.definition.name.include? '-' or e.definition.name.include? '_'
              if e.definition.name.include? '~'
                ename = e.definition.name.gsub!('~','')
              else
                ename = e.definition.name
              end
              if ename.include? '#'
                @names.push(ename.split('#')[0].strip)
              else
                @names.push(ename)
              end
            end
          elsif e.class == Sketchup;;Group
            e.entities.each do |ee|
              if ee.definition.name.include? '-' or ee.definition.name.include? '_'
                if ee.definition.name.include? '~'
                  ename = ee.definition.name.gsub!('~','')
                else
                  ename = ee.definition.name
                end
                if ename.include? '#'
                  @names.push(ename.split('#')[0].strip)
                else
                  @names.push(ename)
                end
              end
            end
          end
        end #ss.each์— ๋Œ€ํ•œ END
        #@name์˜ ๋ฐฐ์—ด ์ˆœ์„œ๋ฅผ ์ •๋ ฌํ•œ๋‹ค.
        @names = @names.sort!
      
        #@name์˜ ๋ฐฐ์—ด์„ ๊ฐ™์€ ๋‚ด์šฉ์„ ๋ฌถ์–ด ํ•ด์‹œ๋กœ ํ†ตํ•ฉํ•œ๋‹ค.
        hash_overlap = @names.each_with_object(Hash.new(0)) { |word,counts| counts[word] += 1 }
      
      
        @comp_names = (hash_overlap.to_a)
      
      
          #comp_names์˜ ๋‚ด์šฉ์„ h, b, t1, t2, length๋ณ„๋กœ ๋ถ„๋ฅ˜ํ•œ๋‹ค.
          @comp_names.each do |str|
            num = str[0].split('-')[1].strip
            i = 0
            while i < num.count('X') + 1
                str.push(num.split('X')[i].strip)
                i = i + 1
            end
            #str.push(num.split('X')[1].strip)
            #str.push(num.split('X')[2].strip)
            #str.push(num.split('X')[3].strip)
            #str.push(num.split('X')[4].strip)
            end
      
        @hash_names.store(ss.name, @comp_names)
        @names = []
        hash_overlap = {}
      end #sel.each์— ๋Œ€ํ•œ end
      

      Group.png

      posted in Developers' Forum
      T
      themonty
    • 1 / 1