Is it possible to send sketchup data to WebDialog?

Hello, I’m developing a plug-in using WebDialog of Sketchup.
Thanks to the help of the community, I entered the Web Dialog with the code below and found a way to use the data entered using JavaScript by importing it into the sketchup.

point_dialog.add_action_callback(“test_html”) {|dialog, data|

If you use this, you can export the data you entered in the html called test_html in WebDialog through JavaScript.

What I am curious about is, on the other hand, can I send the data in the sketchup to WebDialog?
For example, in a sketchup, you draw a line, and you send the corresponding x, y, z coordinates, length, etc. to Web Dialog (html)
I’d like to make it possible to modify the data using the imported data.
Is this possible by any chance?
Thank you.

At first:
WebDialog is deprecated.

Please use HtmlDialog that was introduced in SketchUp 2017.

The #execute_script method is used to execute a JavaScript string on the html dialog asynchronously. You can use it to send data to the dialog. (BTW similar method exist for WebDialog as well)

You can see an examples e.g. here:
GitHub - SketchUp/htmldialog-examples: Examples of using SketchUp Ruby API’s UI::HtmlDialog class

You can check this too: SketchUp Bridge Tutorial | SketchUp Extension Warehouse

There are many topic about it here in a forum. ( Developers Ruby API category)

1 Like

I posted a few exmaple snippets of how to initially load data into an HtmlDialog …

API Issue 646 - Comment

The various ways have also been covered multiple times here in this category.