By Luke Davenport
Problem:
You want an iLogic slider to change feature or part colour (you’ve got a bit of time on your hands!)
Solution:
Yes I probably should be doing something more engineery with my time, but I needed a distraction…. This little iLogic snippet lets you use three sliders on a form to obtain the RGB colour of your choice. Then you can set the level of reflectivity with another slider. Too many iLogic sliders? Let it never be spoken.
Still with me? Excellent.
You can download the Inventor part HERE
Note a couple of things:
- it’s an Inventor 2016 part - you’ll need to download the code below instead if you haven’t upgraded to 2016 yet. It contains an iLogic form just like the one above. Drag the sliders around and watch the magic... (or just watch the colour change)
- You’ll need to drag the ‘End of Part’ marker to the bottom of the feature tree (see below). All the features are currently suppressed to make the file size smaller.
If you can’t download the part you just need to do the following:
- Create 4 parameters in a part file as below (using the ‘Add Numeric’ button). Set any values you like for them.
- Create a new iLogic form
- Add the ‘R’, ‘G’, ‘B’ and ‘Reflectivity’ parameters to the form
- Make the ‘Edit Control Type’ for each of the parameters ‘Slider’, and set the minimum value to 0 and the maximum to 255.
(Except make the maximum value 1 for the ‘Reflectivity’ slider).
- Finish creating the form. It doesn’t do anything yet – this is where we need the iLogic rule to turn those parameters into a RGB colour.
- Copy and paste one of the two iLogic rules in the text file HERE into your part. (Note I’ve included two rules in the text file – one controls the colour of the whole part, and one controls the colour of a specific feature on the part – you can choose which is most applicable for you.
Here’s a quick video of it in action – and yes I was in a Saturday night fever sort of mood…it happens.
- iLogic colour slider.ipt1000 KB
- iLogic Colour Slider.txt3 KB
Comments
1 comment
Great!!
Helped me a lot.
Thank You!
Please sign in to leave a comment.