• Login
sketchucation logo sketchucation
  • Login
๐Ÿค‘ 30% Off | Artisan 2 on sale until April 30th Buy Now

Face Tilt

Scheduled Pinned Locked Moved Newbie Forum
sketchup
10 Posts 3 Posters 1.1k Views
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.
  • M Offline
    MaryamR
    last edited by 4 Feb 2016, 12:11

    http://cdn2.tinyhousedesign.com/wp-content/uploads/2009/02/tiny-simple-house-2-450x406.png

    i'am new to Sketchup C/C++ SDK. I am creating a C/C++ program which gives me the geometry of a house model in Sketchup.I want to get the orientation of all the faces in the model and their Tilt. When I say the word 'Orientation' I mean to get the direction of every face relative to the N direction using the Axes in Sketchup and when i say Tilt i mean the degree of each face' tilt in the grey roof in this example.

    Can anyone come up with a solution or a method to do that?

    Thanks in advance

    1 Reply Last reply Reply Quote 0
    • P Offline
      pilou
      last edited by 4 Feb 2016, 15:29

      Welcome
      Seems you have missed the Develpors section! ๐Ÿ˜‰
      http://sketchucation.com/forums/viewforum.php?f=180

      Frenchy Pilou
      Is beautiful that please without concept!
      My Little site :)

      1 Reply Last reply Reply Quote 0
      • P Offline
        pilou
        last edited by 4 Feb 2016, 15:30

        Welcome
        Seems you have missed the Develops forum section ! ๐Ÿ˜‰

        Frenchy Pilou
        Is beautiful that please without concept!
        My Little site :)

        1 Reply Last reply Reply Quote 0
        • S Offline
          sdmitch
          last edited by 4 Feb 2016, 15:59

          @maryamr said:

          http://cdn2.tinyhousedesign.com/wp-content/uploads/2009/02/tiny-simple-house-2-450x406.png

          i'am new to Sketchup C/C++ SDK. I am creating a C/C++ program which gives me the geometry of a house model in Sketchup.I want to get the orientation of all the faces in the model and their Tilt. When I say the word 'Orientation' I mean to get the direction of every face relative to the N direction using the Axes in Sketchup and when i say Tilt i mean the degree of each face' tilt in the grey roof in this example.

          Can anyone come up with a solution or a method to do that?

          Thanks in advance

          For direction, are we talking about the clockwise or counter clockwise angle from North?

          Is tilt to be measured from vertical or horizontal.

          Nothing is worthless, it can always be used as a bad example.

          http://sdmitch.blogspot.com/

          1 Reply Last reply Reply Quote 0
          • M Offline
            MaryamR
            last edited by 4 Feb 2016, 16:24

            the tilt is to be measured from vertical i want to find the angle between the vertical line and the roof.

            'Orientation' I mean to get the direction of every face relative to the Red Axe, for example a face will have orientation of 90 degrees as it is perpendicular to the red axis.

            thank you

            1 Reply Last reply Reply Quote 0
            • S Offline
              sdmitch
              last edited by 4 Feb 2016, 16:42

              @maryamr said:

              the tilt is to be measured from vertical i want to find the angle between the vertical line and the roof.

              'Orientation' I mean to get the direction of every face relative to the Red Axe, for example a face will have orientation of 90 degrees as it is perpendicular to the red axis.

              thank you

              In Sketchup, the red axis is East not North.

              That said, here is code that will give you the angles.

              mod = Sketchup.active_model
              ent = mod.active_entities
              sel = mod.selection
              faces = sel.grep(Sketchup;;Face)
              faces.each{|f|
               if f.normal.z==0.0
                ang=X_AXIS.angle_between(f.normal)
               else
                ang=Z_AXIS.angle_between(f.normal)
               end
               ent.add_text(Sketchup.format_angle(ang),f.bounds.center,f.normal)
              }
              

              angles.gif

              Nothing is worthless, it can always be used as a bad example.

              http://sdmitch.blogspot.com/

              1 Reply Last reply Reply Quote 0
              • M Offline
                MaryamR
                last edited by 4 Feb 2016, 16:49

                thank you so much for your answer, this code works for C/C++ SDK in a C/C++ program or in Ruby ?
                as i was all day finding just examples in Ruby and i've never used it before.

                thnx

                1 Reply Last reply Reply Quote 0
                • S Offline
                  sdmitch
                  last edited by 4 Feb 2016, 17:43

                  @maryamr said:

                  thank you so much for your answer, this code works for C/C++ SDK in a C/C++ program or in Ruby ?
                  as i was all day finding just examples in Ruby and i've never used it before.

                  thnx

                  Ruby only inside Sketchup I would guess.

                  Nothing is worthless, it can always be used as a bad example.

                  http://sdmitch.blogspot.com/

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    MaryamR
                    last edited by 4 Feb 2016, 22:36

                    i meant the code u suggested is it for Ruby or C/C++ SDK ?

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      sdmitch
                      last edited by 5 Feb 2016, 15:50

                      @maryamr said:

                      i meant the code u suggested is it for Ruby or C/C++ SDK ?

                      Ruby

                      Nothing is worthless, it can always be used as a bad example.

                      http://sdmitch.blogspot.com/

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

                      Advertisement