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

    Indexing Shelf Copies

    Scheduled Pinned Locked Moved Dynamic Components
    sketchup
    7 Posts 2 Posters 10.2k 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.
    • J Offline
      jkoll66
      last edited by

      Hi All, I've created a rack unit with a number of shelves. I need to be able to control the individual shelf heights. In other words, I want to index the copied shelves and let the user determine what height each shelf is. I know this can be done I just don't know how. Can't find a simple example to follow. I've attached the model. Would appreciate some help. Thanks!

      Jeff

      Rack.skp

      1 Reply Last reply Reply Quote 0
      • P Offline
        pcmoor
        last edited by

        missed this post

        solution if you haven't already found it


        adstustable shelves.skp

        1 Reply Last reply Reply Quote 0
        • P Offline
          pcmoor
          last edited by

          update to allow up to 10 shelves, copies calculated by numbers in comma separated string of shelf spacing


          adstustable shelves 2.skp

          1 Reply Last reply Reply Quote 0
          • J Offline
            jkoll66
            last edited by

            Just saw this. Had forgotten about it. Thanks very much!

            1 Reply Last reply Reply Quote 0
            • J Offline
              jkoll66
              last edited by

              pcmoor, Thanks again for the model. I was able to figure out how to add more shelves. I was wondering if you have the time if could you walk me through the DC and how you made it. I'm trying to move beyond the easy stuff. Some of Sketchup's explanations of DC functions are confusing at best. Thanks in advance.

              1 Reply Last reply Reply Quote 0
              • P Offline
                pcmoor
                last edited by

                For the 10 shelf positions you could have used 10 text boxes, this is the simplest method.

                The use of a comma delimited string within a single text box saves space on the option dialog. This requires the use of the find formula, you will note that the FIND formula produces an error if it cannot find what its searching for.

                Coding is done bit by bit. Errors must be circumnavigated as there are no error trapping methods in DCs, (like if error do this.. does not exist)

                The work around is to add what you are looking for to the end of the string you are searching,
                https://sketchucation.com/forums/viewtopic.php?f=289&t=67899

                In the shelf example, I added ten commas, so that if one just put one value in the string, each FIND needs to return a value other than the -1 (error).... Attributes: p1 to p_10

                So, each FIND returns the position of the comma in the string, the MID function isolates bits of text based on the count of each symbol. MID( string, position of comma +1, length which is the next comma, minus the previous -1 ) however if length equals zero then another error, so changed the added ten commas to “0,0,0,0,0,0,0,0,0,0,” .... Attributes: s1 to s_10

                Now need a further check to see if the string has a comma (or delimiter of your choice) at the end, otherwise we would get another zero length in the MID formula We use the difference between the length of string and position of the last comma of the string with a comma attached. Which return 0 (false) if there is a comma in the original string or 1 (true) if not..... Attributes: check

                This is certainly a bit of a mind game, but hopefully after a few or more reads it makes sense

                Another clever trick is to the use of the CURRENT formula to match the copies with the positions, this saves a lot of either nested IF statements or writing out a CHOOSE statement
                Z =current("pos" & copy+1)

                The summation in pos (position of shelf) has a thickness of 20mm, you could have this as an attribute if required

                Copies is based on whether the S values are not zero, true if so. (a return of zero is evaluated as false, whereas any other value is true)

                1 Reply Last reply Reply Quote 0
                • J Offline
                  jkoll66
                  last edited by

                  Been busy and just saw your reply. Thanks for the help pcmoor!

                  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