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?

plunkerでopenjscad その15

Last updated at Posted at 2025-03-25

概要

plunkerでopenjscadやってみる。
練習問題やってみた。

練習問題

getParameterDefinitionsを、使え。

写真

image.png

サンプルコード

function getParameterDefinitions() {
	return [{
		name: 'width',
		type: 'float',
		initial: 10,
		caption: "Width of the cube:",
	}, {
		name: 'height',
		type: 'float',
		initial: 14,
		caption: "Height of the cube:",
	}, {
		name: 'depth',
		type: 'float',
		initial: 7,
		caption: "Depth of the cube:",
	}, {
		name: 'rounded',
		type: 'choice',
		caption: 'Round the corners?',
		values: [0, 1],
		captions: ["No thanks", "Yes please"],
		initial: 0,
	}];
}
function main(params) {
	var result;
	if(params.rounded == 1)
	{
		result = CSG.roundedCube({radius: [params.width, params.depth, params.height], roundradius: 2, resolution: 32});
	}
	else
	{
		result = CSG.cube({radius: [params.width, params.depth, params.height]});
	}
	return result;
}

成果物

以上。

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?