'Behaviors' attribute question about 'Copies'


#1

Rather than give the gory details of the dynamic component in question that I’m working on and how to accomplish getting the specific behavior I want, I’ll start out by asking a more general question and hopefully use any answers to apply towards solving my problem.

Is there any way to create an attribute/value specifically for the last copy? The COPY number changes (dynamically of course…pun intended), as the number of copies is subject to change when the component is scaled. I need to be able to give special treatment (a ‘one-off’) to that last copy (to be specific: change it’s length). I have a way to get that length, but I don’t know how to identify the last copy parametrically. I would assume if this is possible, the attribute and value would go on the panel of the component being copied. ‘COPY’ is identified with an integer (x.0), and I’m not sure if an expression can be used as that INT. I guess I could experiment but it would seem like a ‘Hail Mary’ pass. So, I thought I’d ask here. Thanks for any info.

Weirdly enough, I thought of a solution right after I posted this so maybe I should just do an update right here and now on my possible 'solution, and perhaps get feedback on it: The solution would be largely based on the fact that what I asked above is not possible and even if it was possible could be too convoluted and end up being a major PITA. The solution I think is to tweak my ‘Copies’ attribute so that last copy isn’t created. Then to take it’s place, create a new Component. I can get it’s position and length by knowing it’s start point and end point. It would be sort of cool to not have to do this and use Copies on the original component but sometimes you don’t get what you want…


#2

You should be able to test against the built-in COPIES attribute:

is_last: IF(COPY = COPIES, true, false)

or perhaps

length: IF(COPY = COPIES, 6, 12)


#3

Thanks very much! That’s the type of hint / suggestion / idea I was looking for.

Btw, shouldn’t it be …COPY == COPIES… rather than …COPY = COPIES…? You know, comparison rather than assignment.

I guess I had a mental block against realizing that the COPY and COPIES ‘sequence numbers’ (for lack of a better term) are actual values that can be used in a logical test.

thanks again, jonR


#4

No, a single equals sign is the equality comparison operator.


#5

Here is the list of DC operators.

https://help.sketchup.com/ja/article/114563


#6

Thanks, Jim. Yes, I sort of realized afterwards that you meant what you wrote (single ‘=’) as the operator list appears at the bottom of the Functions dropdown list in the Component Attributes window. Thanks for the link; the list there actually has the descriptions while the list in the CA window does not. -jonR


#7

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.