sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Ruby method to calculate the area of an intersection?

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 539 Views 2 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.
    • B Offline
      buidoi3003
      last edited by

      Hi everyone,
      Please take a look at the attached image. Here is the situation:
      I have only a rectangular.
      Using SketchUp, I can easily draw a circle, select the intersection of my circle & rectangular --> view Entity info --> I can see the area of the intersection.

      However, I want to write a ruby script to automatically draw the circle, then get the intersection area.

      I can automatically draw the circle, no problem. However, I don't know how to automatically get the intersection area. May I know if there is any function in Ruby API can do that?
      There is a face.area() to get the area of the face, however, I don't know how to define the face = intersection. Is there any way to do that?

      Thank you.


      Area.png

      1 Reply Last reply Reply Quote 0
      • B Offline
        buidoi3003
        last edited by

        In other words, my question is:
        How to create a new face/ entity (or whatever) that hold intersection of A and B so that I can then use the area() method to get the area of that intersection.

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

          Assuming f is the reference to the intersecting face object:

          a = f.area()

          See the API Face class.

          I'm not here much anymore.

          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