sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Width, Depth and Length of Component Instance

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 3 Posters 1.1k Views 3 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.
    • daikuD Offline
      daiku
      last edited by

      I need to determine the width, depth, and length of a rectangular solid. Of course, one would just use the bounding box, and this works for me in some instances, but in others, there are sub components that are contained within the parent, but are set at an angle relative to the parent, and whose bounding box thus protrudes outside the rectangular bounds I'm really looking for. See the example. I think the solution is to make a copy, explode it all, then place all the pieces back together as one group, then take it's bounding box, then delete it. Anyone think that will work? Is there a way to put all the pieces into a group? CB.

      http://www.sketchucation.com/forums/scf/sas/Ruby/collar%20example.skp

      Clark Bremer
      http://www.northernlightstimberframing.com

      1 Reply Last reply Reply Quote 0
      • H Offline
        Haggai
        last edited by

        hello,

        If I understood you right here is what I did to your timber.
        Edit the timber component, and then select this tenon edit cut then paste it outside the Timber componentexplode it and make component again, the bounding box will be on the axis, then replace it inside the Timber component, don't forget the other side.

        [Haggai]

        http://www.sketchucation.com/forums/scf/sas/Ruby/collar%20example1.skp

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

          If it's a solid faced rectangule then get the bounds of two (or three) of the 3D opposed faces... then you can work out the xyz dims of the object, without resort to it's over all bounds...

          TIG

          1 Reply Last reply Reply Quote 0
          • daikuD Offline
            daiku
            last edited by

            Haggai:

            That's great - that's just what I want. I see how you did that with your mouse, but how do I do it from within a ruby script?

            TIG:

            It's not really a rectangular solid. In the shop, I cut it from a rectangular solid (a really big piece of timber). I'm working on a ruby to give me the materials list. I need to know what size timber I need to cut something like this. So there may be more faces than just the 6 standard faces of the rectangular solid. I won't know in advance how many, or which face is which.

            Thanks for your help guys. CB.

            Clark Bremer
            http://www.northernlightstimberframing.com

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

              Even if it's not rectangular you can still find horizontal and vertical faces of an enclosing rectangle for its main faces.

              horizontal>>> face.normal.z==-1 >>>down ...==1 >>>up
              vertical>>> face.normal.z==0

              you can find the bottom down face (faceh), find its edges, then find an edge that matches in the se of vertical faces' edge (if you might have say several vertical faces then find the one with the longer edges if that's the one you need etc...)

              you now have a long bottom face (faceh) and an adjoining vertical face (facev) that's sharing a (long) edge.

              faceh.bounds.max.x-faceh.bounds.min.x and similarly for .y give the plan size (x & y) and facev.bounds.max.z-facev.bounds.min.z give the overall height (z) ?

              TIG

              1 Reply Last reply Reply Quote 0
              • daikuD Offline
                daiku
                last edited by

                TIG:

                Unfortunately, that won't work for all cases. Here's another example.
                The result I want in this case is 10" x 10" x about 11'. But this one does not have a "horizontal" face. The "bottom" face has bounds of ~7' x ~7'. I know how to "lay it down". But I think the next step is to recursively explode it, and then un-explode it again and take the bounds of the new object. But I have no idea how to un-explode.

                This all works perfectly if I do it manually, but how to do it from ruby?

                Seems like I've been here before... CB.

                http://www.sketchucation.com/forums/scf/sas/Ruby/rafter_example.skp

                Clark Bremer
                http://www.northernlightstimberframing.com

                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