Indexing Shelf Copies  Topic is solved

Indexing Shelf Copies

Postby jkoll66 » Tue Oct 23, 2018 9:35 pm

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!




Re: Indexing Shelf Copies

Postby pcmoor » Sun Nov 25, 2018 6:13 am

missed this post

solution if you haven't already found it


Re: Indexing Shelf Copies

Postby pcmoor » Sun Nov 25, 2018 10:17 am

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


Re: Indexing Shelf Copies

Postby jkoll66 » Wed Dec 05, 2018 4:37 pm

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


Re: Indexing Shelf Copies

Postby jkoll66 » Mon Dec 10, 2018 6:49 pm

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.


Re: Indexing Shelf Copies  Topic is solved

Postby pcmoor » Tue Dec 11, 2018 12:43 pm

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,

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)


Re: Indexing Shelf Copies

Postby jkoll66 » Tue Jan 22, 2019 9:50 pm

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


SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Ad Machine 


Return to Dynamic Components


Who is online

Users browsing this forum: No registered users and 0 guests

Visit our sponsors: