0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

windows11で、sketchup6 その95

Posted at

概要

windows11に、sketchup6を入れてみた。
rubyで、3Dを書く。
練習問題やってみた。

練習問題

webdialogで、rubyコンソールを書け。

写真

image.png

サンプルコード


def testweb1
	wd = UI::WebDialog.new("Ruby ", true, 'Console', 500, 200)
	wd.set_html <<-EOS
		<html>
		<head>
		</head>
		<body>
		<textarea id="out" cols=60 rows=5></textarea>
		<br>
		<input type="text" id="src" size="58" value="alert" ><a href="skp:run">run</a>
		</body>
		</html>
	EOS
	wd.add_action_callback('run') do |d, a|
		command = wd.get_element_value('src')
		puts command
		res = command + " => "
		begin
			result = eval(command)
			res += result.inspect.inspect
		rescue Exception => e
			res += e.message.inspect
			res += e.backtrace.inspect.inspect
		end
		wd.execute_script("document.getElementById('out').value ='#{res}';")
	end
	wd.show
end



以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?