Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
FreeCADマクロ stlファイル出力自動化
Search
kamakiri1225
October 04, 2022
Science
3.3k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
FreeCADマクロ stlファイル出力自動化
kamakiri1225
October 04, 2022
More Decks by kamakiri1225
See All by kamakiri1225
【技術書典20】OpenFOAM(自宅で深める流体解析)流れと熱移動(2)
kamakiri1225
0
460
【技術書典18】OpenFOAM 自宅で深める流体解析の基礎と応用 (1)
kamakiri1225
0
480
OpenRadiossSafetyダミーモデルの紹介
kamakiri1225
0
320
20230518数値流体解析の基礎
kamakiri1225
0
110
20241109_OpenRadiossを用いたエアバッグ 解析のモデル構築
kamakiri1225
0
870
【技術書典17】OpenFOAM(自宅で極める流体解析)2次元円柱まわりの流れ
kamakiri1225
0
2.9k
20201205_final_report_水の物性_光の速度計算.pdf
kamakiri1225
0
66
20201208_final_report_光の速度計算.pdf
kamakiri1225
0
45
第100回オープンCAE勉強会@関西
kamakiri1225
0
470
Other Decks in Science
See All in Science
ダメな自分の育て方―性格タイプの「劣等機能」から理解するニガテ克服術
ppillc
0
150
AI(人工知能)の過去・現在・未来 —AIは人間を超えるのか—
tagtag
PRO
0
120
データベース03: 関係データモデル
trycycle
PRO
1
540
YouTubeにおける撤回論文の参照実態 / metascience-meetup2026
corgies
3
280
SHINOMIYA Nariyoshi
genomethica
0
140
見上公一.pdf
genomethica
0
150
[NLP2026 参加報告会] AI for Science まとめ / NLP2026
lychee1223
0
1.9k
俺たちは本当に分かり合えるのか? ~ PdMとスクラムチームの “ずれ” を科学する
bonotake
2
2.4k
NDCG is NOT All I Need
statditto
2
3.2k
Conversation is the New Dashboard: 属人性を排除する第4世代BIツールの勢力図
shomaekawa
1
590
Understanding CVP Waveforms: Interpretation and Clinical Implications in Anesthesiology
taka88
0
570
人生を変えた一冊「独学大全」のはなし / Self-study ENCYCLOPEDIA: The Book Which Change My Life #独学大全 #EM推し本
expajp
0
160
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
Raft: Consensus for Rubyists
vanstee
141
7.5k
Producing Creativity
orderedlist
PRO
348
40k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.6k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
Test your architecture with Archunit
thirion
1
2.3k
Faster Mobile Websites
deanohume
310
31k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.3k
Transcript
None
ASCIIファイルをstlファイルにする 一連の面倒な操作はPythonのマクロ でやってしまおう
メッシュは削除
stlファイル出力したい面だけ 「bc:」と頭に付ける
「マクロ」>「マクロ…」 「export_stl.py」を以下に保存 or 編集 C:/ユーザ名/AppData/Roaming/FreeCAD/Macro
export_stl.py import os import Mesh import MeshPart # 現在のディレクトリ PWD
= r'C:¥work¥openfoam¥20220929_FreeCAD_stl¥stl' print('現在のディレクトリ:',PWD) labels = [] doc = App.ActiveDocument print(doc) for obj in doc.Objects: if obj.Label[0:3] == 'bc:': mesh = doc.addObject("Mesh::Feature", "Mesh") print(mesh) # mefisto #mesh.Mesh = MeshPart.meshFromShape(Shape=obj.Shape, MaxLength=10) # standard mesh.Mesh = Mesh.Mesh(obj.Shape.tessellate(0.01)) print(mesh.Mesh) label = obj.Label[3:] labels.append(label) Mesh.export([mesh], fr'{PWD}/{label}.ast') print(label) doc.removeObject(mesh.Name) print(doc.Label) print(labels, type(labels)) with open(rf'{PWD}/{doc.Label}.stl', 'w') as f: print('test') for label in labels: with open(rf'{PWD}/{label}.ast', 'r') as fi: for line in fi: if line[:5] == 'solid': line = 'solid ' + label + '¥n' elif line[:8] == 'endsolid': line = 'endsolid ' + label + '¥n' f.write(line) for label in labels: os.remove(rf'{PWD}/label.ast') 中身の編集 「export_stl.py」を実行 stlファイルが出力