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

    .edges returns a face

    Scheduled Pinned Locked Moved Developers' Forum
    9 Posts 5 Posters 229 Views 5 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.
    • T Offline
      timwarner
      last edited by

      I can't figure this one out. Here's the output from the Ruby Console:

      back
      #Sketchup::Face:0x1cbbfe74
      back.edges.each{|e| puts e}
      #Sketchup::Edge:0x1cbc1850
      #Sketchup::Edge:0x1cbc1a1c
      #Sketchup::Face:0x1cbcfc84
      #Sketchup::Edge:0x1cbc0cc0
      [#Sketchup::Edge:0x1cbc1850, #Sketchup::Edge:0x1cbc1a1c, #Sketchup::Face:0x1cbcfc84, #Sketchup::Edge:0x1cbc0cc0]

      How can the .edges method return a Face?

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

        BUT
        face.edges doesn't return a face, it does return an array of edges.
        face=Sketchup.active_model.selection[0] #<Sketchup::Face:0xef75e64> face.edges [#<Sketchup::Edge:0xf0a8b10>, #<Sketchup::Edge:0xef75e78>, #<Sketchup::Edge:0xf0a8c28>]
        or
        face.edges.each{|e|puts e} #<Sketchup::Edge:0xf0a8b10> #<Sketchup::Edge:0xef75e78> #<Sketchup::Edge:0xf0a8c28> [#<Sketchup::Edge:0xf0a8b10>, #<Sketchup::Edge:0xef75e78>, #<Sketchup::Edge:0xf0a8c28>]
        Are you using the standard Ruby Console ?
        Do you have any other tools that might ill-advisedly mess with the base-classes like Sketchup::Face ?
        Your installation is most likely 'broken' πŸ˜•
        Have you considered reinstalling ?

        TIG

        1 Reply Last reply Reply Quote 0
        • T Offline
          timwarner
          last edited by

          @tig said:

          BUT
          face.edges doesn't return a face, it does return an array of edges.
          face=Sketchup.active_model.selection[0] #<Sketchup::Face:0xef75e64> face.edges [#<Sketchup::Edge:0xf0a8b10>, #<Sketchup::Edge:0xef75e78>, #<Sketchup::Edge:0xf0a8c28>]
          or
          face.edges.each{|e|puts e} #<Sketchup::Edge:0xf0a8b10> #<Sketchup::Edge:0xef75e78> #<Sketchup::Edge:0xf0a8c28> [#<Sketchup::Edge:0xf0a8b10>, #<Sketchup::Edge:0xef75e78>, #<Sketchup::Edge:0xf0a8c28>]
          Are you using the standard Ruby Console ?
          Do you have any other tools that might ill-advisedly mess with the base-classes like Sketchup::Face ?
          Your installation is most likely 'broken' πŸ˜•
          Have you considered reinstalling ?

          Yes, it's the standard Ruby Console.
          No, I have no other tools that mess with the base-class.
          I'll re-install and see what happens.
          Thx for the feedback.

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by

            I'd be interested in seeing the model (or portion of) to see if it can be reproduced.

            Hi

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

              Tim, are you really still using SketchUp 8.0.4810 ??

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • T Offline
                timwarner
                last edited by

                I reinstalled SU and the problem went away, so it looks like TIG was correct. I'll have to check my backups to see what version of SU was running (it would have been current, though). The profile info was obsolete.

                1 Reply Last reply Reply Quote 0
                • K Offline
                  kwalkerman
                  last edited by

                  I did see something like that once before - I had a plugin that traced faces and did something like:

                  face.edges.each do |e|

                  do something with an edge

                  end

                  ... and every once in 10,000 faces, I'd see something like you're describing, although I could never reproduce it on command. This was with SU 7.0. I never found a fix - just found another way to execute the plugin.

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

                    @kwalkerman said:

                    I never found a fix - just found another way to execute the plugin.

                    Likely:

                    face.edges.each do |e|
                      next unless e.is_a?(Sketchup;;Edge)
                      # do something with an edge
                    end
                    

                    I'm not here much anymore.

                    1 Reply Last reply Reply Quote 0
                    • K Offline
                      kwalkerman
                      last edited by

                      Dan - the bug came immediately after:

                      if e.is_a? Sketchup::Edge

                      ... it was very strange, and as I said, happened once in a great while - I couldn't figure out how to make it happen on command.

                      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