thomasa88 / ParametricText

Fusion 360™ add-in for creating Text Parameters in sketches.
MIT License
75 stars 5 forks source link

Unable to update parameters #46

Closed scooper4711 closed 1 year ago

scooper4711 commented 1 year ago

Describe the bug When updating text parameter, I get an error message

To Reproduce Steps to reproduce the behavior:

  1. Create a sketch and add a text that says “PARAM”.
  2. Click MODIFY -> Change Text Parameters
  3. Select the first element in the list.
  4. Click on the “PARAM” text.
  5. Enter V{_.version} in the text box.
  6. Click OK.
  7. See error

Expected behavior The text updates

Screenshots Stack Trace: Fusion 360 v. 2.0.13377 /Users/stephen/Library/Containers/com.autodesk.mas.fusion360/Data/Library/Application Support/Autodesk/ApplicationPlugins/ParametricText.bundle/Contents/thomasa88lib/events.py failed:

Traceback (most recent call last): File "/Users//Library/Containers/com.autodesk.mas.fusion360/Data/Library/Application Support/Autodesk/ApplicationPlugins/ParametricText.bundle/Contents/thomasa88lib/events.py", line 142, in catcher func(args) File "/Users//Library/Containers/com.autodesk.mas.fusion360/Data/Library/Application Support/Autodesk/ApplicationPlugins/ParametricText.bundle/Contents/ParametricText.py", line 621, in map_cmd_execute_handler save(cmd) File "/Users//Library/Containers/com.autodesk.mas.fusion360/Data/Library/Application Support/Autodesk/ApplicationPlugins/ParametricText.bundle/Contents/ParametricText.py", line 658, in save update_texts(texts=texts) File "/Users//Library/Containers/com.autodesk.mas.fusion360/Data/Library/Application Support/Autodesk/ApplicationPlugins/ParametricText.bundle/Contents/ParametricText.py", line 1322, in update_texts text_updated = set_sketch_text(sketch_text, evaluate_text(text, sketch_text, next_version)) File "/Users//Library/Containers/com.autodesk.mas.fusion360/Data/Library/Application Support/Autodesk/ApplicationPlugins/ParametricText.bundle/Contents/ParametricText.py", line 711, in set_sketch_text check_text_height_bug(sketch_text) File "/Users//Library/Containers/com.autodesk.mas.fusion360/Data/Library/Application Support/Autodesk/ApplicationPlugins/ParametricText.bundle/Contents/ParametricText.py", line 790, in check_text_height_bug sketch_text.height = test_height File "/packages/adsk/fusion.py", line 64797, in _set_height return _fusion.SketchText__set_height(self, value) RuntimeError: 2 : InternalValidationError : res

Software

Do not forget to "Subscribe" to the issue if you want updates!

thomasa88 commented 1 year ago

Hi, I cannot reproduce this on Windows with Fusion 360 2.0.15027 x86_64. ParametricText v 2.3.0. I created a new document (not saved) and followed your steps.

The code that fails is a workaround for a bug where Fusion would reset the text height if the text was changed programmatically. A quick test indicates that this bug might have been fixed. https://forums.autodesk.com/t5/fusion-360-api-and-scripts/bug-setting-sketchtext-properties-resets-text-height-since-v-2-0/m-p/10357593

Does the error always happen for you now? Even if you restart Fusion?

In that case, please try this: In /Users//Library/Containers/com.autodesk.mas.fusion360/Data/Library/Application Support/Autodesk/ApplicationPlugins/ParametricText.bundle/Contents/ParametricText.py at line 149:

Change

text_height_workaround_state_ = WorkaroundState.Check

to

# !46 workaround
text_height_workaround_state_ = WorkaroundState.Disabled
scooper4711 commented 1 year ago

Having restarted Fusion, I am no longer able to recreate the issue. Closing.