sketchucation logo sketchucation
    • Login
    ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

    Creating Arcs

    Scheduled Pinned Locked Moved Plugins
    7 Posts 3 Posters 625 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.
    • honoluludesktopH Offline
      honoluludesktop
      last edited by

      Anyone have problems with @entities.add_arc, and selection.add_arc ? I am using Acad's dxf definition of arc for starting, and ending angle, but am getting a circle, not an arc.

      vector = Geom;;Vector3d.new 0,0,1  
      @vector2 = Geom;;Vector3d.new 1,0,0  
      @vector3 = vector.normalize! 
      .
      .
      .
      my_arc = @entities.add_arc [@entity[0],@entity[1],@entity[2]], @vector2, @vector3, @entity[3], @entity[4], @entity[5], 24
      

      Am I too tired to see the obvious?-) Hanging it up, and going to bed.

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

        Check the data you are feeding the method.

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

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

          There is only a entities.add_arc(...) method - there isn't one for 'selection' πŸ˜•

          TIG

          1 Reply Last reply Reply Quote 0
          • honoluludesktopH Offline
            honoluludesktop
            last edited by

            Thanks tt, and oops about my own typo TIG. I meant to write status = entities.add_selection my_arc, where my_arc = @entities.add_arc [@entity[0],@entity[1],@entity[2]], @vector2, @vector3, @entity[3], @entity[4], @entity[5], 24.>_<

            1 Reply Last reply Reply Quote 0
            • honoluludesktopH Offline
              honoluludesktop
              last edited by

              Finally got back to this, and checked data as suggested. I had to rotate the normalized z and x axis, and convert my data to radians. Too bad the API is not set up for beginners, or Architects:-) Now on to calculate the default number of line segments for arcs.

              my_arc = @entities.add_arc [@entity[0]+@block_x,@entity[1]+@block_y,@entity[2]+@block_z], @vector2, @vector3, @entity[3], @entity[4]*(Math::PI/180), @entity[5]*(Math::PI/180), 24

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

                There are methods to convert between degrees and radians:
                http://code.google.com/apis/sketchup/docs/ourdoc/numeric.html

                From radians to degrees:
                1.22.radians

                From degrees to radians:
                30.degrees

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

                1 Reply Last reply Reply Quote 0
                • honoluludesktopH Offline
                  honoluludesktop
                  last edited by

                  Well, I finally took the time to make this really work. Starting and finishing angles are measured in radians, measured counter clockwise from the +x axis. I needed to add 360 to the finishing angle.

                  When:
                  vector = Geom::Vector3d.new 0,0,1 @vector2 = Geom::Vector3d.new 1,0,0 @vector3 = vector.normalize!
                  The correct arc is drawn by:
                  my_arc = @entities.add_arc [@entity[0]+@block_x, @entity[1]+@block_y, @entity[2]+@block_z], @vector2, @vector3, @entity[3], (@entity[4]*Math::PI)/180, ((360+@entity[5])*Math::PI)/180

                  @block_? is the location of the block/group from the origin. When an entity, its value is 0.0, nothing.

                  Only problem now, is that the data from my Cad's DxfOut, and Acad's seems to be different. I have to check the spec. by their version numbers, but I can't believe they have changed that much.>_< But "Oh well", that's why I am writting this s*^&&y app.:-)

                  Addenda: I found this variable tags 210, 220, and 230 (extrusion direction) wherein my Cad's DxfOut is [0,0,-1], and the default Acad's is [0,0,1]. What's an extrusion direction?

                  Addenda: z=-1 in [x,y,z] seems to mean that the arc is mirrored around the world view origin. It appears that when z=1 in [x,y,z], the arc is mirrored on the y axis, and set by (see the green (-)) below:
                  my_arc = @entities.add_arc [%(#008000)[-]@entity[0]+@block_x, @entity[1]+@block_y, @entity[2]+@block_z], @vector2, @vector3, @entity[3], (@entity[4]*Math::PI)/180, ((360+@entity[5])*Math::PI)/180

                  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