1
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?

More than 1 year has passed since last update.

FreeCADの直方体のワイヤーフレームの体積計算をChatGPT-3.5先生に聞きました。

Last updated at Posted at 2024-03-05

オリジナル

日本語フォーラム

ChatGPT 3.5先生 へ

freecadのマクロを教えて下さい。
直方体のワイヤーフレームを書いて、それをソリッドに変換、4等分したその体積を教えて下さい。

ChatGPT 3.5先生 より

以下抜粋

import FreeCAD as App
import Part

# 直方体を作成
length = 10  # 長さ
width = 5    # 幅
height = 8   # 高さ
box = Part.makeBox(length, width, height)

# ソリッドに変換
solid = box.makeSolid()

# ソリッドを4つに分割
cut_plane = App.Placement(App.Vector(0, 0, 0), App.Rotation(App.Vector(0, 0, 1), 45))
splits = solid.cut(box.copy().Placement.multiply(cut_plane))

# 4つのソリッドの体積を計算
total_volume = 0
for split in splits:
    total_volume += split.Volume

# 結果を出力
print("直方体の体積:", solid.Volume)
print("4等分した各体積の合計:", total_volume)

以下のエラーがでました。

<class 'AttributeError'>: 'Part.Solid' object has no attribute 'makeSolid'

つづく

勉強中

1
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
1
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?