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?

材料力学「Cremona_diagram(クレモナ図) は何ですか。」をAI先生に聞きました。

Last updated at Posted at 2025-05-31

・「進めて。」ばかりで。何を聞いているのかわからなくなってきました。
 いい方法を教えて下さい。
「進めて。」の直前のChatGPT先生の提案のみを拾う事ができますか。
 ChatGPT先生へどのように聞けばいいですか?

(本日の)ChatGPT先生へ

質問リスト

・質問リストの追番は無視して下さい。1個ずつです。途中の回答表示は省略しています。

# 質問リスト
1. Cremona_diagram は何ですか。
2. 教えて下さい。
3. 理解したいです。
4. 上記をsympy のソースコードで教えて下さい。
5. 上記の結果も出力して下さい。
6. 続けて下さい。
7. 全て教えて下さい。
8. FreeCADで。
9. 構造図で。
10. 教えて下さい。
11. 節点で。
12. 進めて下さい。
13. 2
14. 進めて。
15. 進めて。
16. 進めて。
17. 「力の方向矢印追加」で。
18. 私の質問をMarkdown形式でリスト化して出力して。Markdown形式でリストからアスタリスクは削除して。1行目に、# 質問リスト の文字を出力して。最後の質問も追加して下さい。追番を追加して下さい。Markdown形式で。

🧩 FreeCADスクリプト:矢印付きCremona図(強化版)

import FreeCAD, Draft

doc = FreeCAD.ActiveDocument if FreeCAD.ActiveDocument else FreeCAD.newDocument("CremonaWithArrows")

# --- 力データ(例:内力) --- #
internal_forces = {
    ("A", "B"): 5.774,
    ("A", "C"): -7.216,
    ("B", "C"): -7.216
}

external_forces = {
    "A": (0, 0),
    "B": (0, 0),
    "C": (0, -10)
}

nodes = {
    "A": (0, 0),
    "B": (4, 0),
    "C": (2, 3)
}
node_vecs = {name: FreeCAD.Vector(x, y, 0) for name, (x, y) in nodes.items()}

# --- 設定 --- #
cremona_base = FreeCAD.Vector(10, 0, 0)
scale = 0.5

def get_color(force_value):
    return (0.0, 0.0, 1.0) if force_value > 0 else (1.0, 0.0, 0.0)  # 青:引張, 赤:圧縮

def add_arrow(start, end, color):
    arrow = Draft.make_arrow(start, end, size=0.3)
    arrow.ViewObject.LineColor = color
    arrow.ViewObject.ArrowType = "Arrow"

# --- Cremona図の描画 --- #
for node in nodes:
    p0 = cremona_base
    force_list = []

    ext = external_forces.get(node, (0, 0))
    if ext != (0, 0):
        fx, fy = -ext[0], -ext[1]
        force_list.append(("P", FreeCAD.Vector(fx, fy, 0)))

    for (a, b), val in internal_forces.items():
        if node == a or node == b:
            other = b if node == a else a
            vec = node_vecs[other] - node_vecs[node]
            unit = vec.normalize()
            dir_vec = unit if val > 0 else -unit
            force = dir_vec.multiply(abs(val))
            force_list.append((f"F_{a}{b}", force))

    current = p0
    for name, vec in force_list:
        end = current.add(vec.multiply(scale))
        color = get_color(vec.Length if vec.Length > 0 else -1)

        # 線 + 矢印
        line = Draft.make_line(current, end)
        line.ViewObject.LineColor = color
        add_arrow(current, end, color)

        # ラベル
        label_pos = current.add(FreeCAD.Vector(0.3, 0.3, 0))
        Draft.make_text([f"{name} = {vec.Length:.2f}"], point=label_pos)

        current = end

    cremona_base = cremona_base.add(FreeCAD.Vector(0, -6, 0))

doc.recompute()

・エラーがでます。あきらめました。
 : module 'Draft' has no attribute 'make_arrow'

Gemini先生へ

copilot先生へ

いつもの? sympyの実行環境と 参考のおすすめです。

(テンプレート)

いつもと違うおすすめです。

wikipedia

・日本語版 クレモナ図がありませんでした。

Qiita

sympyのDoc 

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?