• Login
sketchucation logo sketchucation
  • Login
๐Ÿค‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Option to select sub-component type

Scheduled Pinned Locked Moved Dynamic Components
sketchup
6 Posts 3 Posters 1.5k 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.
  • B Offline
    bigstick
    last edited by 5 Feb 2009, 14:24

    Sorry if this has been covered elsewhere, but does anyone know if it is possible to define a component which selects one of a number of sub-components, depending upon user input?

    I have created a DC of a prefabricated floor slab unit (Bison floor beams), which creates a horizontal array when the DC is stretched.

    I would like to be able to configure it so that either:-

    a.) There is an input box to select the slab thickness, which in turn chooses which component to insert and array

    b.) Takes the span, and based on a formula (derived from manufacturer's load/span tables) automatically chooses the sub-component which corresponds to the appropriate slab thickness, and arrays it

    I would prefer the second, but first of all I need to be able to use input to select a particular component to use. I could of course scale the component in the z axis, but not all the components have the same profile, and I would like to be accurate if possible!

    I'm sure I have seen something mentioned about selecting components somewhere, but can't find anything now. Anyone have any ideas, information or suggestions?

    1 Reply Last reply Reply Quote 0
    • S Offline
      scottlininger
      last edited by 5 Feb 2009, 16:38

      bigstick,

      The technique that I've seen is to include all of your variations as subcomponents, and then use the "hidden" attribute to hide all but the one you want to show.

      For example, if you have an attribute at the parent level called "panelType" that contains either a 1, 2, or 3, then your 3 subcomponents could have a formula to decide which is hidden.

      Tile1:
      hidden= parent!panelType<>1

      Tile2:
      hidden= parent!panelType<>2

      Tile3:
      hidden= parent!panelType<>3

      At any given time, only one of the 3 tiles will be shown.

      Hope I understood the question! Let us know if you have more.

      Cheers,

      • Scott Lininger
        SketchUp Software Engineer
        Have you visited the Ruby API Docs?
      1 Reply Last reply Reply Quote 0
      • C Offline
        Chris Fullmer
        last edited by 5 Feb 2009, 20:04

        Yup, that is how I have approached that same scenario! Though Scott's is written much cleaner than mine ever ise ๐Ÿ˜„

        Chris

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

        1 Reply Last reply Reply Quote 0
        • B Offline
          bigstick
          last edited by 6 Feb 2009, 08:43

          Cool - thanks guys! I'll try this, sounds easy enough to add an 'if..' statement to determine which flag to set for component selection. Would it be okay to upload the component here if I need a little help with the syntax?

          1 Reply Last reply Reply Quote 0
          • B Offline
            bigstick
            last edited by 6 Feb 2009, 13:36

            Here is the component - kind of complete. I have a slight issue where I would like the user to be able to select between typical office loading and maximum loading. I have configured a dropdown list for this, but I would like to be able to activate it with the onclick function. I could add attributes for each loading and select between them with a combobox I guess, but I'm too lazy to do that. ๐Ÿ˜‰

            The component uses an approximate calculation for the span. The load/span tables are here (http://www.bison.co.uk/products.aspx?ID=12 ).

            I needed to select a particular beam depth based on the span, and didn't want to have too many complex nested if statements, so I calculated an approximate span to beam depth ratio and divided the overall span by it to give me an index for selecting the beam type. It seems to work pretty well so far.

            Comments and observations gratefully accepted before I upload to 3DWH. I don't want to upload for general use unless I'm confident I have configured it as efficiently as possible. Feel free to modify the component if you wish.


            Bison Hollowcore.skp

            1 Reply Last reply Reply Quote 0
            • C Offline
              Chris Fullmer
              last edited by 6 Feb 2009, 17:47

              Looks good so far. I did notice a few things though.

              There are a few extra lines lying around. 2 inside the main component, then 1 inside the board component. Maybe more I didn't see, but those stuck out at me.

              When I scale to me them longer, they jump and resize incorrectly. If its on typical span, then they shrink down to really small.

              Good luck, they look great!

              Chris

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

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

              Advertisement