- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I created a command script that will generate multiple offsets from a single-loop Profile.
The command inputs are:
- A SelectionInput filtered for 1 Profile
- An IntegerSpinnerCommandInput to specify the number of sketch curves to generate.
- A DistanceValueCommandInput to specify the total offset distance to span.
I decided to add a userParameter for the totalOffsetDistance so that I could make adjustments. Adding this line of code..
design.userParameters.add('totalOffsetDistance', ValueInput.createByReal(totalOffsetDistance), "cm", "")
to the execute handler gives two different behaviors based on whether it is before or after this (assuming there is exactly 1 valid Profile selected).
profileSelectionCommand:SelectionCommandInput = inputs.itemById('profileSelection')
profileSelection:Selection = profileSelectionCommand.selection(0)
If the UserParameter is added before the selection is gotten, it we get an invalid index and we can test to see that the selectionCount is indeed 0. However, if we move that line afterwards, we are able to retrieve the selected Profile just as normal. It's not hard to work around but it is undocumented/unregulated and perhaps unintended behavior from a software engineering perspective.
Solved! Go to Solution.