CadQuery - กรอบงานการเขียน CAD แบบ parametric ด้วย PythonCadQuery - A Python Parametric CAD Scripting Framework
CadQuery เป็นเฟรมเวิร์กการเขียนสคริปต์ CAD แบบปรับแต่งได้ด้วย Python ที่ออกแบบเพื่อสร้างโมเดลสามมิติตามสคริปต์
CadQuery is a Python framework for script-based creation of customizable 3D CAD models.
ไว้ทำอะไร
CadQuery ใช้แก้ปัญหาในการสร้างโมเดล CAD สามมิติโดยใช้สคริปต์ Python ที่สามารถปรับเปลี่ยนได้ง่าย ช่วยให้วิศวกรและนักวิจัยสามารถสร้างและแปรปรวนโมเดลต่างๆ ได้สะดวก นอกจากนี้ ยังเน้นให้โมดูลสามารถรวมเข้ากับระบบอื่นโดยไม่มี GUI ซึ่งทำให้สามารถใช้งานได้ในหลายกรณี เช่น การประมวลผลบนเซิร์ฟเวอร์ การเขียนสคริปต์ทางวิทยาศาสตร์และวิศวกรรม
ทำงานอย่างไร
CadQuery ทำงานผ่านกระบวนการเขียนสคริปต์ Python เพื่อสร้างโมเดล CAD เมื่อรันสคริปต์ โมดูลจะใช้ OCCT เพื่อสร้างรูปทรงเรขาคณิตสูง (BRep เช่น Solid, Edge และ Face) นอกจากนี้ยังมีโมดูลสำหรับเลือกและปรับแต่งรูปทรงเช่น selectors และ assembly ระเบิดพลังงานโดยใช้วิธี Workplane เพื่อระบุแนวระดับการทำงาน เสริมด้วยฟังก์ชัน utils ที่ช่วยในกระบวนการต่างๆ สามารถส่งออกโมเดลในรูปแบบ CAD ที่มีคุณภาพสูง เช่น STEP หรือ STL
โครงสร้างโค้ด
- __init__.py — เปิดใช้งานโมดูลหลัก
- cq.py — โค้ดหลักสำหรับการสร้าง CAD
- assembly.py — การทำงานเกี่ยวกับ assembly
- selectors.py — การเลือกเฉพาะรูปร่างเรขาคณิต
- vis.py — การสร้างภาพ
- occ_impl/ — เต็มไปด้วยการนำเข้าและส่งออกผ่าน OCCT
เริ่มใช้งาน
mamba install -c conda-forge cadquery
conda create -n cadquery
conda activate cadquery
pip install cadquery
เหมาะกับงานแบบไหน
- สร้างโมเดลทางวิศวกรรม
- การจำลองชิ้นส่วนทางกายภาพ
- การสร้างและปรับแต่งเครื่องมือเฉพาะทาง
ข้อควรรู้
- อย่าลืมว่าข้อจำกัดในการใช้ pip โดยเฉพาะกรณีระบบที่ไม่รองรับ Python 3.9-3.12
- CadQuery ไม่มีสิทธิ์ใช้งานอัปเดตในไฟล์ แต่ README ระบุ Apache License 2.0
What it is for
CadQuery addresses the challenge of creating 3D CAD models using customizable Python scripts, allowing engineers and researchers to develop and iterate models easily. It is designed to be a Python library without a GUI, making it suitable for server-side applications and scientific and engineering scripting.
How it works
CadQuery operates by utilizing Python scripts to generate CAD models. When scripts are executed, the module uses OCCT to build high-level geometries (BRep like Solid, Edge, and Face). It includes modules for selecting and custom shaping such as selectors and assembly, and leverages workplanes to define working levels. Utilities in utils assist in various processes. Models can be exported in high-quality CAD formats like STEP or STL.
Code structure
- __init__.py — Core module initialization
- cq.py — Main code for CAD creation
- assembly.py — Handles assembly operations
- selectors.py — Manages geometric selections
- vis.py — Manages visualization
- occ_impl/ — Contains import/export through OCCT
Getting started
mamba install -c conda-forge cadquery
conda create -n cadquery
conda activate cadquery
pip install cadquery
Good fit for
- Developing engineering models
- Simulating physical components
- Designing and customizing specialized tools
Things to know
- Beware of pip installation limitations, particularly on systems not supporting Python 3.9-3.12.
- No license file in the main directory, but README states Apache License 2.0.
บทวิเคราะห์นี้สร้างจาก README และโค้ดของ repo โดย AI ของ Oneable — ตรวจสอบ license และเอกสารต้นทางก่อนนำไปใช้งานจริงThis breakdown was generated from the repository's README and code by Oneable's AI — check the license and upstream docs before using it in production.