Trouble modifying Parametric plugin

parametric.rb (10.5 KB)

I’m using the “Parametric” plugin that was created by Trimble awhile back and am attempting to modify it to suit my needs. The plugin in short allows you to create “Parametric” objects that you can edit using a context menu option that prompts the user for values.

I am having a couple issues which I’ve been trying to solve without adding a ton of unneeded complexity.

I’m unsure how to allow for the ordering of parameters within the inputbox. I’m assuming I’d need to include the proper ordering in the inheriting classes somehow but haven’t been able to come up with a simple solution.

I have a few other issues with the prompt method. One being the inability to add drop down option lists to the inputbox. I know how you do it normally but not while fitting with the structure of the Parametric code. I’ve thought maybe I need to include this in the inheriting class along with the solution for ordering parameters and override its prompt method changing it slightly but am drawing a blank on how exactly to go about doing this.

Lastly, I’d like to be able to supply Parametric objects with some data that is hidden from the user when they attempt to edit it. The reason I want to do this instead of relying on constants is because in some cases I will be creating Parametric objects automatically with data supplied from a spreadsheet. In those cases the extra data would be supplied but I don’t want to bog the user down with a ton of input options that they don’t care about.

I don’t expect anyone to do all this for me but I would greatly appreciate any suggestions anyone has to offer.

Thank you

Note that the Parametric class was updated in one of the other plugin examples, but not the standalone example.
It might be the Window example.

Regardless, you need to wrap whatever you modify within your own namespace, as future changes to a toplevel Parametric class could cause breaking changes.

The order is the order of parameters in the array arguments passed to UI.inputbox.

You’ll need to modify the class’s constructor #initialize method to handle the case of an array value.
[ "default_choice", "choice1|choice2|choice3" ]
When the hash value is an array like this, then the option would be a droplist.

Then modify the #prompt method (line 161 of the file you attached) to use the second form of UI.inputbox

      results = inputbox( prompts, values, choices, title )

Above this (in the data.each loop) you need to handle the case when value.is_a?(Array) and push the 1st element into values, and the second into a choices array (which needs also to be defined in that method.)
IMPORTANT, any non-droplist option will need an empty string pushed into the choices array !.

You’ll also need to modify the storage loop at the end of the method to handle droplist choice lists.

1 Like

Yep! That’s what I’ve done. I attached an unmodified version to my original post.

Yeah, I knew that but still reading it written out like that has given me ideas on how to make that work. I was coming from a way different angle. Making it way more complex than it needed to be.

This is exactly the kind of help I was looking for thank you so much!

1 Like

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