Programmatically Determine if Configuration is From Design Table

Programming and macros
User avatar
JSculley
Posts: 590
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 7
x 822

Programmatically Determine if Configuration is From Design Table

Unread post by JSculley »

Is there a method via the API to determine if a configuration is controlled by a design table? I'm looking for something that doesn't involve activating the design table.
User avatar
josh
Posts: 261
Joined: Thu Mar 11, 2021 1:05 pm
Answers: 11
x 19
x 453

Re: Programmatically Determine if Configuration is From Design Table

Unread post by josh »

I can't see where that's exposed in the API. It's obviously stored somewhere because the tree shows a different icon for DT controlled configs, but I don't see it anywhere.
User avatar
AlexLachance
Posts: 2032
Joined: Thu Mar 11, 2021 8:14 am
Answers: 17
Location: Quebec
x 2187
x 1888

Re: Programmatically Determine if Configuration is From Design Table

Unread post by AlexLachance »

josh wrote: Mon Oct 24, 2022 4:54 pm I can't see where that's exposed in the API. It's obviously stored somewhere because the tree shows a different icon for DT controlled configs, but I don't see it anywhere.
Could you check for a code that loads the excel file..? I'm guessing that is stored inside the file and thus not a valid route.
User avatar
bnemec
Posts: 1869
Joined: Tue Mar 09, 2021 9:22 am
Answers: 10
Location: Wisconsin USA
x 2463
x 1344

Re: Programmatically Determine if Configuration is From Design Table

Unread post by bnemec »

I'm going to show off my ignorance and ask a question I came to after trying to look into this. If I were using API to edit a model (not even considering configurations now), how would I determine if the value I'm changing is/was controlled by a design table?

My line of thought is the info in one/some the parameter(s) of the config rather than the config object itself? Llooking at GetParameters Method (IConfiguration) to get the parameters then check if the parameter is controlled by design table?
User avatar
josh
Posts: 261
Joined: Thu Mar 11, 2021 1:05 pm
Answers: 11
x 19
x 453

Re: Programmatically Determine if Configuration is From Design Table

Unread post by josh »

Good line of thought... The Dimension object does have an IsDesignTableDimension property. However, it appears to me (after an admittedly quite brief test) that this returns "True" if the dimension is controlled by the DT in any config, whether or not the currently active config is controlled by the DT. The dimension also shows the "controlled by DT" system color in the UI for configs. If you enable "Block model edits that would update the DT", trying to edit this dimension gives you the error message that it's controlled by the DT, although it then does allow you to change the value if the current config is not in the DT. If the current config is in the DT, the edit box never even comes up.

I can't see anything different in the values returned by GetParameters between DT and non-DT configs either.

It might be possible to set the DT properties to block model edits, then read the params, see which are DT controlled, then try to change a value and see if the change is successful or not. If the change is successful, this config is not in the DT. Of course, there are a number of other conditions that might make the change fail. Or it might be possible that this is a way to get around blocked model edits... I did find that it's possible in the UI to "specify configs" when editing a value while a non-DT config is active. I was able to change DT controlled dimensions in DT controlled configs even with model edits blocked using this method.
User avatar
JSculley
Posts: 590
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 7
x 822

Re: Programmatically Determine if Configuration is From Design Table

Unread post by JSculley »

josh wrote: Mon Oct 24, 2022 4:54 pm I can't see where that's exposed in the API. It's obviously stored somewhere because the tree shows a different icon for DT controlled configs, but I don't see it anywhere.
Yeah. And I want to use it for exactly that: displaying the appropriate icon.
User avatar
JSculley
Posts: 590
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 7
x 822

Re: Programmatically Determine if Configuration is From Design Table

Unread post by JSculley »

SPR 289114 - Would like API to tell whether configuration is driven by Design Table

It's a relatively new SPR from July 2021.

It would be nice to have but it isn't essential for me, so I'll sign up to be notified if it is implemented and move on.
Post Reply