Dynamic Block with Array, Count and Colour Change

Dynamic Block with Array, Count and Colour Change

Anonymous
Not applicable
2,598 Views
3 Replies
Message 1 of 4

Dynamic Block with Array, Count and Colour Change

Anonymous
Not applicable

Hello!

 

I am trying to create a dynamic block representing electric spring terminals. The spring terminal is just a green square with a wipeout. I have then added an increment-based array function, so the user can pull down as many terminals he/she wants. The wipeout is stretched to reduce number of coordinates in the drawing.

 

However, in our electric layout drawings, every 10 terminal should be shown in a secondary colour (red) to make it easier to count them. My temporary solution is a visibility parameter so the user can make blocks of 10 terminals and decide the colour on each block.

 

The dwg is attached.

 

Problem 1

Does anyone know a smart way to make the terminal change colour automatically on the 11th terminal, and then back to the original colour on the 21st, etc. ?

 

Problem 2

Is there a way to display the count of the last terminal automatically, preferably with 3 digits (i.e. 003, 075 or 211)?

 

Any help would be appreciated 😄

0 Likes
Accepted solutions (1)
2,599 Views
3 Replies
Replies (3)
Message 2 of 4

Libbya
Mentor
Mentor
Accepted solution

See attached.  It works up to 80.  Above that, you would need to add the appropriate values to the two lookup tables.  Lookup1 is fairly self explanatory.  Just follow the same pattern.  On Lookup2, above 40 the visibility state should alternate between 40+E and 40+O.

 

Every time the number is changed a regen is required to update the count field.

  

Message 3 of 4

Anonymous
Not applicable

A million thanks! A brilliant solution!

 

I am not quite sure what you did to administrate the colour changing. (I have never used the LookUp function before). As far as I understand, you made six visibility states with predefined colour patterns and used those as lookup variables, based on increments of 10?

 

I tried to expand the allowed numbers of terminals, but after 80 the colours of the extended terminals keeps the same colour.

Any hints?

 

/Lars

0 Likes
Message 4 of 4

Libbya
Mentor
Mentor

Lookup1 parameter is what I call a double-lookup.  It is a very special dynamic block item.  It is different from a typical lookup parameter in that it has two tables attached to it rather than one.  In order to see both tables set the system variable BACTIONBARMODE to 0.  At that point you will see both tables (named Lookup1 and Lookup2).  You need to edit the values of both tables in the manner I described in my last post.  You also need to make sure that the 'Lookup Properties' names match on the two tables.  You only edited the values on Lookup2.  Add the appropriate values to Lookup1 table and it should work fine.  Let me know if you hit a snag.

 

The way the block works is as follows.  

 

Distance2 is the linear parameter with the shown grip.  It is set to a 2.5 increment with a 2.5 min.  It has four actions attached to it as follows.  Scale scales the Distance4 parameter which is 1/2.5 the distance of Distance2.  The length of Distance4 is used for the count field display  Move moves the count attribute.  Array2 arrays the blocks of 10 Red rectangles.  Stretch1 stretches the wipeout, Distance3 and the Distance1 linear parameter.  The Distance1 parameter is chained and arrays the single rectangles.  Distance3 is chained and arrays the blocks of 10 Green rectangles.

 

Position1 is a point parameter that has a single stretch action that stretches the base point of the Distance1 parameter.

 

Lookup1 parameter is a double-lookup with the tables Lookup1 which is used for input and Lookup2 which is used for output.  Lookup1 table uses Distance2 as its input property in order to determine the 'Lookup Property'.  Lookup2 changes the visibility state and the Y position of  Position1 based on the 'Lookup Property' determined by the Lookup1 table.  

 

I noticed one other slight issue/detail.  I used two number count attributes.  One of them is called Number 0-10.  It has two leading zeros padded to the front of the value.  Number0-10 is displayed for the 0-10 visibility state.  The other is called Number10-100 and has a single zero padded to the front of the value and is displayed for all other visibility states.  The issue that I noticed is that the Number0-10 is displayed for the value of 10 which actually makes 4 digits (two leading zeros a 1 and a trailing zero).  To fix it I would add a third attribute called Number10.  I would change Number0-10 to be Number0-9.  I would create another visibility state called 10.  I would change the visibility state 0-10 to be 0-9.  I would add a row to both lookup tables with a lookup property of 10.  I would change the lookup property 0-10 on both tables to be 0-9.  For lookup1 table I would change the range value for lookup property 1-9 to be (0,22.5].  I would make 25 be the value for lookup property 10.  On lookup2 table I would make the visibility state 0-9 show for the lookup property 0-9 and the visibility state 10 show for the lookup property 10.  I would keep the value 0 for Position1Y for lookup property 0-9.  I would add 0 as the Position1 Y value for lookup property 10.