Is it possible for SU to avoid complex DC calculations when not relevant?

Hi there,

Firstly just to say thank you to this community generally - the wealth of topics discussed here has solved many a problem of mine over the years! I owe the likes of Dan Rathbun & pcmoor a pint hundreds of times over! Now I have a problem that I can’t find a solution for in the forum, and I’m hoping someone can help.

I’m updating a library of DCs for work, each containing endless nested sub-components within nested sub-components. They’re complex DCs - necessarily so for the variety of functions they perform.

The issue I’m having is a significant increase in processing time after changing any component options, following some recent changes. I’ve described the situation as best I can with screenshots below, without going into too much detail on the inner workings. Unfortunately I can’t attach a file as these components aren’t to be made public.

The DCs are of glass partitioning, which sometimes feature bars applied to the glass. There are vertical bars & horizontal bars, spaced as appropriate depending on user input. The HB2 bars are sub-components of the HB1 components.

It’s sometimes necessary to add notches & raking to the glass partitioning, as in the screenshots below. I’ve spent a lot of time adding calculations to adjust the position / length / hidden status of the HB2 bars to accommodate this.

The problem I have is that these calculations mostly have to be performed at the level of the HB2 bars, and have become incredibly complex to accommodate all possibilities. The number of HB2 bars quickly adds up, resulting in SU performing hundreds of complex calculations just for this single small section.

On occasions where notching and/or raking is required, this is acceptable. However, often neither are required, and very rarely would they both be required in the same glass section. However, it seems as if every calculation is being performed every time, drastically slowing the performance for even the less complex models.

The HB2 components each contain 30+ custom attributes to perform these calculations - some for notching, and others for raking. Using the following method I’ve tried to make SU avoid performing unnecessary calculations, but it doesn’t seem to work.

  • I’ve added custom attributes called Calc_Notches & Calc_Raking, which display 0 when the notch/raking calculations should be performed, else 1.

  • For each of the 30+ custom attributes, I include =IF(Calc_Notches/Calc_Raking=0, [complex calculation], 0 or 1 [depending on the calculation])

  • I hoped that this would essentially inform SU not to bother performing the calculation when not relevant, and to skip straight ahead to outputting 0/1. This doesn’t seem to be the case!

I wonder if anyone knows of a way to get SU to avoid making calculations like this when it doesn’t need to? Any help would be greatly appreciated!

I’ve tried playing around with attribute inspector to introduce hidden attributes where I can store the calculations as text Strings, then bring them into play as Float calculations if Calc_Notches/Calc_Raking=0, but (somewhat unsurprisingly) this doesn’t work either. I’ve got a fair amount of experience with DCs but attribute inspector is new to me & programming in Ruby is not something I’ve ever touched upon.

Thanks! :blush:

Some suggestions

If not required, then hide, run a script to delete hidden. works provided if DC code is top down. If for some reason need to amend with the super DC, just swap the modified instance with the saved “Super DC” definition

Make a simple DC to cover majority of structure with other DCs for notches and rakes. Or swap this for the Super DC.

Really need to look at your workflow, maybe private message or video call?

Hi Philip,

You’ve done it again - that’s another pint I owe you in thanks!

It’ll mean some rejigging on my part, but the Replace Selected solution should work nicely. I’ll keep the HB2 instances simple by default, then in the case of any notches / raking the users can select & replace any that don’t look right with the “Super DC” as you suggest.

Thanks so much for your help, it’s really appreciated!

With swaps, if using an extension, check naming and updates correct. You can use the native right click swap (shortcut?), however for DCs, the scalable sizes has to be saved initially with the “CURRENT” formula (okay, later. these can be overwritten then it’s an instance) and referenced to a lower child. Then the swap will update to the current size