thomasa88 / ParametricText

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

Text in moved sketch does not update (RuntimeError: 2 : InternalValidationError) #61

Open Andrew553328 opened 9 months ago

Andrew553328 commented 9 months ago

Hello Thomas :)

Describe the bug Text does not update when moved off Z=0, dwg on xy plane

To Reproduce Steps to reproduce the behavior:

  1. create any text on xy plane
  2. use Fx to create a parameter to change. I use the .comment
  3. use Tx to select the text
  4. you will find the text updates correctly
  5. HOWEVER, move the text to 5mm above the xy plane plane and update fails without error

My application is this: I produce a set of planar parts from one parametric model, the parts are altered by a python script. I only want one part to have a label. As the parts are 3d printed the text is elevated to the part thickness as separate bodies ( enabling color change )

thomasa88 commented 9 months ago

Reproduced in ParametricText 2.3.3.

  1. New document
  2. Create the parameter a' with the commentccc`.
  3. Create a sketch with a text.
  4. Assign {a.comment} using "Change Text Parameters".
  5. Text is updated.
  6. Use "Move" command to move the sketch.
  7. Change the text parameter text to {a.comment}A
  8. Text is not updated.
  9. Error in console (Ctrl+Alt+C, Py mode, write 1):
Copy this message by taking a screenshot. Describe what you did to get this error or record a video.

--------------------------------------------------

Fusion 360 v. 2.0.18220
\\vboxsvr\thomas\my_src\fusion360\ParametricText\thomasa88lib\events.py failed: 

Traceback (most recent call last):
  File "//vboxsvr/thomas\my_src/fusion360/ParametricText\thomasa88lib\events.py", line 142, in catcher
    func(args)
  File "//vboxsvr/thomas/my_src/fusion360/ParametricText/ParametricText.py", line 631, in map_cmd_execute_handler
    save(cmd)
  File "//vboxsvr/thomas/my_src/fusion360/ParametricText/ParametricText.py", line 668, in save
    update_texts(texts=texts)
  File "//vboxsvr/thomas/my_src/fusion360/ParametricText/ParametricText.py", line 1333, in update_texts
    text_updated = set_sketch_text(sketch_text, evaluate_text(text, sketch_text, next_version))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "//vboxsvr/thomas/my_src/fusion360/ParametricText/ParametricText.py", line 728, in set_sketch_text
    sketch_text.text = text
    ^^^^^^^^^^^^^^^^
  File "/packages\adsk\fusion.py", line 86683, in _set_text
    return _fusion.SketchText__set_text(self, value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: 2 : InternalValidationError : res

This looks like an internal Fusion error when trying to set the text 🤔.

Interesting that Fusion does not show the button to save the current placement of things.

The only workaround I can offer at the moment is that you don't move the sketch, but instead create it in the correct place from the start or offset any extrude made from it.

thomasa88 commented 9 months ago

Reported to Autodesk: https://forums.autodesk.com/t5/fusion-api-and-scripts/bug-internalvalidation-when-setting-sketchtext-text-in-moved/td-p/12553570

Andrew553328 commented 9 months ago

Good morning Thomas :)

I have made some progress. Sketch text is on z=0 Push/pull text with offset of thickness of part with 0.5mm text height, works.

See Hexx.au for the application.

I am wanting to print a set of parametrically altered parts with just one part having text. There are 3 lines of text. The last line of text set to blank or just spaces does not clear the embossing.

I am trying to set visibility of bodies just now...

Regards, Andrew

Get Outlook for iOShttps://aka.ms/o0ukef


From: Thomas Axelsson @.> Sent: Monday, February 12, 2024 12:39:43 AM To: thomasa88/ParametricText @.> Cc: andrew gossy.net @.>; Author @.> Subject: Re: [thomasa88/ParametricText] ParametricText (Issue #61)

Reproduced:

  1. New document
  2. Create the parameter a' with the comment ccc`.
  3. Create a sketch with a text.
  4. Assign {a.comment} using "Change Text Parameters".
  5. Text is updated.
  6. Use "Move" command to move the sketch.
  7. Change the text parameter text to {a.comment}A
  8. Text is not updated.
  9. Error in console (Ctrl+Alt+C, Py mode, write 1):

Copy this message by taking a screenshot. Describe what you did to get this error or record a video.


Fusion 360 v. 2.0.18220 \vboxsvr\thomas\my_src\fusion360\ParametricText\thomasa88lib\events.py failed:

Traceback (most recent call last): File "//vboxsvr/thomas\my_src/fusion360/ParametricText\thomasa88lib\events.py", line 142, in catcher func(args) File "//vboxsvr/thomas/my_src/fusion360/ParametricText/ParametricText.py", line 631, in map_cmd_execute_handler save(cmd) File "//vboxsvr/thomas/my_src/fusion360/ParametricText/ParametricText.py", line 668, in save update_texts(texts=texts) File "//vboxsvr/thomas/my_src/fusion360/ParametricText/ParametricText.py", line 1333, in update_texts text_updated = set_sketch_text(sketch_text, evaluate_text(text, sketch_text, next_version)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "//vboxsvr/thomas/my_src/fusion360/ParametricText/ParametricText.py", line 728, in set_sketch_text sketch_text.text = text ^^^^^^^^^^^^^^^^ File "/packages\adsk\fusion.py", line 86683, in _set_text return _fusion.SketchText__set_text(self, value) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RuntimeError: 2 : InternalValidationError : res

This looks like an internal Fusion error when trying to set the text 🤔.

Interesting that Fusion does not show the button to save the current placement of things.

The only workaround I can offer at the moment is that you don't move the sketch, but instead create it in the correct place from the start or offset any extrude made from it.

— Reply to this email directly, view it on GitHubhttps://github.com/thomasa88/ParametricText/issues/61#issuecomment-1937757771, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVN63IUVF5YKQ76YZIVF563YTDCZ7AVCNFSM6AAAAABDBF5XKWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZXG42TONZXGE. You are receiving this because you authored the thread.Message ID: @.***>

Andrew553328 commented 9 months ago

Hello Thomas :)

Im nearly there. I successfully change the shape of a part via a python script I can change text via fx using the mouse when i change the text via script the entry in the fx table is changed but the text remains unchanged in the drawing.

parametrictext.py does not register fx changes by script ( is there a change flag inside the fx function ?)

Regards Andrew

thomasa88 commented 9 months ago

Hi, I think you might to look at this: https://github.com/thomasa88/ParametricText/issues/54#issuecomment-1605672507

edit: Btw, if you are creating simple shapes OpenSCAD could be a good fit for your designs.