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

    "Tell me what's goin' on. I ain't got a clue!"

    Scheduled Pinned Locked Moved Developers' Forum
    28 Posts 6 Posters 1.2k Views 6 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.
    • TIGT Offline
      TIG Moderator
      last edited by

      If you haven't defined 'plane' then it's taken to be nil, so the test is if nil==something if something is also nil then it's true !!! πŸ˜’

      TIG

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

        How were we meant to know that you had defined 'plane' as a method, let alone a variable - which it seemed it might be at first glance, there were no clues in your published code ???
        If you publish half of the story you'll get a lot more 'answers' than you need... ❓

        TIG

        1 Reply Last reply Reply Quote 0
        • M Offline
          MartinRinehart
          last edited by

          @tig said:

          If you haven't defined 'plane' then it's taken to be nil, so the test is if nil==something if something is also nil then it's true !!! πŸ˜’

          TIG, plane is defined. attr_reader ... :plane ... is equivalent to

          
          def plane()
              return @plane
          end
          
          

          edit: and this being Ruby plane is also plane() - maybe not Matz's best decision as this discussion shows.

          All of which is to say I've got good working code that produces faces facing the positive end of the perpendicular axis and it does this by reverse!() for everything not in the 'rb' plane and I've no clue why and the standard answer "SU draws upside down in the rg plane when z=0" is true but it's not an answer to my question.

          Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

          1 Reply Last reply Reply Quote 0
          • M Offline
            MartinRinehart
            last edited by

            @tig said:

            How were we meant to know that you had defined 'plane' as a method, let alone a variable - which it seemed it might be at first glance, there were no clues in your published code ???
            If you publish half of the story you'll get a lot more 'answers' than you need... ❓

            My apologies.

            Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

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

              So, what does the plane() method look like?

              Hi

              1 Reply Last reply Reply Quote 0
              • thomthomT Offline
                thomthom
                last edited by

                @jim said:

                So, what does the plane() method look like?

                There is none. He used attr_reader(:plane) which is the same as:

                def plane()
                  return @plane
                end
                

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

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

                  Yes, well, I see that now. 😳 So it's just a string anyway.

                  Hi

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

                    Seems this is making it all too complicated for its own good πŸ˜‰
                    What's wrong with testing @plane directly ?

                    TIG

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

                      @tig said:

                      Seems this is making it all too complicated for its own good πŸ˜‰

                      There is no doubt of that.

                      Hi

                      1 Reply Last reply Reply Quote 0
                      • thomthomT Offline
                        thomthom
                        last edited by

                        @jim said:

                        Yes, well, I see that now. 😳 So it's just a string anyway.

                        No - it's nothing. it's nil until a value is assigned. it just makes the instance variable available to the outside scope.

                        but in the context of Martin's code - yes @plane is a string.

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

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

                          @thomthom said:

                          but in the context of Martin's code - yes @plane is a string.

                          I was looking back at the original code and just skimmed over the later post. Even so, there is still no clue to what type of object @plane refers since the actual assignment is not given.

                          Hi

                          1 Reply Last reply Reply Quote 0
                          • C Offline
                            cjthompson
                            last edited by

                            this is a bit off topic, but I was just curious: how would you handle a rectangle that has a normal of (1,1,-1) or something similar?

                            1 Reply Last reply Reply Quote 0
                            • M Offline
                              MartinRinehart
                              last edited by

                              @tig said:

                              What's wrong with testing @plane directly ?

                              That would be best. I forgot the "@" - simple coding goof - but the test got done, the program worked, so I didn't notice.

                              Would have been better if method calls needed parens so you a) see that it's a method call, b) get a compile-time error for forgetting the "@" and c) fix your simple mistake, instead of publishing it.

                              But back to the original topic. If you draw your points clockwise ... What's clockwise?

                              tri_red.jpg

                              Clockwise above is origin, up blue axis, out on rg plane, right?

                              tri_green.jpg

                              Clockwise is origin, out on rg plane, up blue axis, right?

                              Note that both shots are of the same model, with a wee bit of orbiting to change point of view. Ergo, an unqualified "clockwise" is meaningless.

                              A bit off topic, the title is Jimmy Buffett in "Everybody's Got a Cousin in Miami" paraphrasing Jimmy Buffett in "Margaritaville." It accurately describes my knowledge re normals after a face is drawn.

                              Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

                              1 Reply Last reply Reply Quote 0
                              • Chris FullmerC Offline
                                Chris Fullmer
                                last edited by

                                Clcokwise is where the face's normal is pointing directly back at "you" when "you" draw it. So orientation within the model is meaningless.

                                Lately you've been tan, suspicious for the winter.
                                All my Plugins I've written

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

                                  The 'right-hand' rule: you grasp the normal axis [above the face] in your right-hand with your thumb pointing in the positive direction.
                                  Your fingers will curl in the counter-clockwise direction.
                                  The 'left-hand' rule is the reverse of this...
                                  When you return an array of a face's vertices they are always listed counter-clockwise... right-hand rule... β˜€

                                  TIG

                                  1 Reply Last reply Reply Quote 0
                                  • M Offline
                                    MartinRinehart
                                    last edited by

                                    @chris fullmer said:

                                    pointing directly back at "you" when "you" draw it

                                    Could you explain this little bit, in small words? Thx.

                                    @tig said:

                                    you grasp the normal axis [above the face]

                                    Does "above" mean on the side of the normal? How can I control which side is "above"? Thx.

                                    Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

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

                                      'Above' in this context is on the side of the face's front.
                                      If the face is flat and it were facing upwards your hand would be above it.
                                      The that face were facing downwards then your hand would be underneath it...

                                      TIG

                                      1 Reply Last reply Reply Quote 0
                                      • 1
                                      • 2
                                      • 2 / 2
                                      • First post
                                        Last post
                                      Buy SketchPlus
                                      Buy SUbD
                                      Buy WrapR
                                      Buy eBook
                                      Buy Modelur
                                      Buy Vertex Tools
                                      Buy SketchCuisine
                                      Buy FormFonts

                                      Advertisement