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

    Posts

    Recent Best Controversial
    • RE: Getting normal to cylinder face

      Cheers TIG, that did the trick.

      posted in Newbie Forum
      P
      peterjohnson84
    • Getting normal to cylinder face

      Hi there,

      I am having some trouble with some code I'm writing and was wondering if there was a simple solution that I'm unaware of.

      My aim is to find vector the normal to a cylinder face (where the cylinder has beeen 'stored' as a group) and from that, work out the orientation of the cylinder group. So far, I have been able to do this for a cylinder which I created. However if I rotate the cylinder and perform the same operation, the normal vector does not change with the rotation i.e. if I create a cylinder aligned along the z axis - circle.normal will always give (0,0,1) despite any rotation i perform on the group.

      I assume the information about the rotation is stored somewhere and from this I could work out the cylinder orientation - but I'm at a loss to work out how to do this.

      Any help with this would be greatly appreciated.

      posted in Newbie Forum sketchup
      P
      peterjohnson84
    • RE: Interrogating each group to find Cylinders & Cubes

      That's the badger! Though as is the way with these things, it seems so simple once I know the solution.

      Thankyou very much anyway...that has helped me a great deal.

      posted in Developers' Forum
      P
      peterjohnson84
    • RE: Interrogating each group to find Cylinders & Cubes

      I am also working on this problem and though I follow the logic behind the code you wrote - I am struggling to implement it.

      How do you get sketchup to recognise the group.(...) method? i.e. stop it returning the error:

      undefined local variable or method `group' for JF::WebConsole:Module

      when I type:

          face=nil
          group.entities.each{|e|
            if e.class==Sketchup;;Face
              face=e
              break
            end
          }
          not_cuboid=false
          not_cuboid=true if face.edges.length!=4
          faces=[]; face.all_connected.each{|e|faces << e if e.class==Sketchup;;Face}
          not_cuboid=true if faces.length!=6
          faces.each{|f|
            if f.edges.length!=4
              not_cuboid=true
              break
            end
          }
      

      Its as if sketchup doesn't know what group I'm referring to - doesn't know what 'group' even is. After searching I have noticed some talk about 'active_entities' and suspect the answer may be invlved with this somehow.

      Apologies if this sounds like nonsense - I think I'm missing something big, but can't work out what it is.

      Cheers, Pete

      posted in Developers' Forum
      P
      peterjohnson84
    • 1 / 1