科研 Skill
SolidWorks参数化建模自动化
solidworks-cad
Automates parametric pump impeller design and other mechanical modeling tasks through the SolidWorks API. Use when a user wants to script SolidWorks part, assembly, or drawing creation.
SKILL.md
SolidWorks CAD Integration
This skill provides guidance for automating parametric pump impeller design and other mechanical component modeling using the SolidWorks API.
Overview of SolidWorks API
SolidWorks provides a comprehensive API that allows users to automate design tasks, create parametric models, manipulate assemblies, and generate drawings programmatically. The API exposes the full functionality of SolidWorks through COM interfaces, enabling external applications to control SolidWorks and access its features.
Key capabilities:
- Parametric part and assembly creation
- Feature manipulation and dimension control
- Sketch creation and editing
- Drawing automation and annotation
- File import/export operations
- Simulation and analysis integration
- Bill of materials (BOM) generation
Licensing Requirements
Important: SolidWorks API access requires:
-
Valid SolidWorks License: A full SolidWorks license is required to use the API. The API cannot be used with viewer-only licenses.
-
License Types:
- SolidWorks Standard, Professional, or Premium
- Network (concurrent) or standalone licenses both support API access
- SolidWorks PDM integration requires additional PDM licenses
-
Windows Platform: SolidWorks and its API are Windows-only. The API utilizes COM/ActiveX technology specific to Windows.
-
Version Compatibility: Ensure your API code matches your SolidWorks version. API methods may vary between versions.
API Access Methods
1. VBA Macros
VBA (Visual Basic for Applications) is the built-in scripting environment in SolidWorks.
Advantages:
- Native integration with SolidWorks
- No external dependencies
- Easy to debug within SolidWorks
- Direct access to UI elements
Use Cases:
- Quick automation scripts
- User interaction through forms
- Prototyping API workflows
Access: Tools > Macro > New or Edit in SolidWorks
2. Python (via win32com)
Python can control SolidWorks through the win32com package (pywin32).
Advantages:
- Modern, readable syntax
- Extensive Python ecosystem for data processing
- Integration with scientific libraries (NumPy, pandas)
- Easier to version control and test
Requirements:
pip install pywin32
Use Cases:
- Batch processing of parts
- Data-driven design automation
- Integration with engineering calculations
- Export/import workflows
3. C# .NET
C# provides strong typing and robust development tools for SolidWorks automation.
Advantages:
- Best performance
- Strong typing and IntelliSense support
- Comprehensive error handling
- Professional application development
Requirements:
- Visual Studio
- SolidWorks Interop Assemblies (installed with SolidWorks)
Use Cases:
- Custom SolidWorks add-ins
- Enterprise integration applications
- Complex automation workflows
- Standalone applications controlling SolidWorks
Common Tasks
Parametric Part Creation
Create parts with dimensions that can be modified programmatically:
- Define sketches with dimensional constraints
- Create features (extrude, revolve, sweep, loft)
- Add relations between features
- Set global variables and equations
Impeller Blade Geometry
Specialized tasks for pump impeller design:
- Blade Profile Generation: Create complex 3D curves for blade profiles
- Swept Features: Use guide curves and profiles to create blade surfaces
- Circular Patterns: Array blades around the central axis
- Hub and Shroud Modeling: Create the central hub and outer shroud geometries
- Fillet Operations: Add fillets for manufacturing and performance optimization
- Parametric Control: Link blade angles, thickness, and count to design variables
Assembly Automation
Automate assembly creation and modification:
- Insert components into assemblies
- Apply mates (coincident, concentric, distance, angle)
- Create patterns of components
- Detect interferences
- Manage assembly configurations
Drawing Generation
Automatically create and populate engineering drawings:
- Create drawing sheets from templates
- Insert model views (standard, section, detail)
- Add dimensions and annotations
- Generate BOMs and balloons
- Export to PDF or DWG
File Export
Export SolidWorks models to neutral formats:
- STEP (ISO 10303): Industry-standard for CAD data exchange
- IGES: Legacy format, widely supported
- Parasolid: High-fidelity geometry transfer
- STL: For 3D printing and mesh-based analysis
- DXF/DWG: 2D drawing export for manufacturing
Best Practices
- Error Handling: Always implement robust error handling as API operations can fail
- Version Control: Keep API code separate from CAD files for better version control
- Documentation: Document units, coordinate systems, and design intent
- Testing: Test API scripts on simple models before applying to complex designs
- Performance: Suppress screen updates and rebuild operations for better performance
- Cleanup: Always release COM objects properly to avoid memory leaks
Learning Resources
- SolidWorks API Help: Access from Help > API Help in SolidWorks
- API SDK: Includes examples and documentation (installed with SolidWorks)
- Online Community: SolidWorks Forums and user groups
- Sample Code: Available in SolidWorks installation directory
Limitations and Considerations
- Platform: Windows-only, no macOS or Linux support
- Performance: Complex operations may be slow; consider batch processing during off-hours
- Licensing: Requires active SolidWorks session (consumes a license)
- Version Dependencies: API changes between SolidWorks versions may break scripts
- COM Complexity: Understanding COM object model is essential for advanced use
Integration with Engineering Workflow
The SolidWorks API is particularly valuable for:
- Design Optimization: Parametric studies with multiple design variants
- CFD Preprocessing: Automated geometry preparation for OpenFOAM or ANSYS
- Manufacturing: Automated drawing generation and BOM creation
- Product Configurators: Customer-driven product customization
- Data Management: Integration with PLM/PDM systems
示例提示词
帮我写SolidWorks API脚本自动生成这组参数化泵叶轮模型。
所属插件
安装该插件会一并获得同领域的 35 个 Skill / MCP。
同插件的其他科研 Skill
- FDM增材制造可制造性设计Checks an existing STEP part for FDM printability with the AgentsCAD method: overhang detection, reorientation, chamfers, and kernel plus visual verification. Use for DFAM review before 3D printing.
- 激光粉末床合金可打印性筛选Screens metal alloy compositions for laser powder bed fusion printability using CALPHAD or built-in thermophysical data and Rosenthal melt pools. Use when choosing or qualifying an AM alloy.
- 增材制造文献问答检索Answers additive-manufacturing questions from the user’s own PDF library with page-cited evidence via retrieval. Use for literature-grounded AM questions instead of relying on memory.
- CADSmith文本生成CADGenerates dimensionally exact CadQuery CAD from natural language using the CADSmith plan-code-validate-refine loop. Use when the user describes a part in words and wants a CAD model.
- OpenFOAM CFD仿真自动搭建Sets up, runs, diagnoses, and reports OpenFOAM CFD cases from a plain-language request using registered flow families and deterministic accept/reject validators. Use for guided OpenFOAM case setup.
- 机械设计评审文档汇编Assembles a mechanical design-review package: requirements traceability, design FMEA with RPN, costed multi-level BOM, risk register, and a PDR/CDR checklist. Use when preparing a design review.
- 面向制造的可制造性评审Reviews a part or assembly for CNC machining, sheet metal, injection molding, casting, or 3D printing manufacturability, flagging rule violations. Use when the user asks for a DFM/DFMA check.
- 工程图纸与GD&T审查Reviews mechanical drawings (PDF, image, or DXF) for dimensioning errors, GD&T misuse, datum problems, and ASME Y14.5/ISO GPS compliance. Use when checking a drawing before release.
- 工程计算报告生成Turns engineering calculations or scripts into a formal calculation report with objective, assumptions, equations, and unit-checked results. Use for a calc report ready for sign-off.
- LLM-SR方程发现Discovers interpretable equations from engineering data with the LLM-SR loop: skeleton proposals, constant fitting, and out-of-domain scoring. Use for symbolic regression on experimental data.
- 疲劳断裂寿命分析Estimates fatigue life and crack-growth life for metal parts from S-N data, load histories, and fracture-mechanics inputs. Use for Miner’s-rule damage, rainflow counting, or Paris-law crack growth.
- 图像直接生成FDM G代码Converts a photo, sketch, or slice image of a flat or near-flat part directly into FDM G-code without CAD, via silhouette and toolpath extraction. Use for sketch-to-print without modeling.
- 点阵结构刚度逆向设计Designs 3D-printable lattice unit cells for a target stiffness using TPMS cells, printability checks, and voxel homogenization. Use for lattice infill or metamaterial design.
- 平面连杆机构综合Synthesizes planar four-bar or six-bar linkages whose end-effector traces a target curve, using graph-based topology and forward-kinematics search. Use for mechanism path-generation problems.
- LLM驱动FDM打印逐层监控Monitors an FDM print layer by layer through Klipper/Moonraker, diagnosing defects from camera images and applying safety-bounded G-code corrections. Use to watch or fix a live 3D print.
- LLM迭代桁架优化设计Designs and optimizes 2D trusses with an LLM-in-the-loop FEM workflow where proposed members are scored by an exact truss FEM. Use for iterative truss topology or sizing optimization.
- L-PBF缺陷区间预测Predicts L-PBF defect regime (keyholing, lack of fusion, balling, or none) from process parameters and checks melt-pool dimensions against standard criteria. Use when selecting LPBF parameters.
- L-PBF熔池图像超分辨率Upscales low-cost webcam images of an L-PBF build plate to high resolution via registration and a trained diffusion or CNN model. Use for in-situ L-PBF monitoring with cheap cameras.
- 机械零件强度校核Sizes and checks machine elements: bolted joints, shafts for fatigue, bearings for L10 life, springs, welds, and gears, with shown work and safety factors. Use to size or verify a machine element.
- Ashby材料选型Selects engineering materials with the Ashby method: translate function and constraints into a performance index, then screen and rank a shortlist. Use when choosing between candidate materials.
- 产品逆向拆解分析Reverse-engineers a physical product as an engineering system: function structure, costed BOM, DFA index, should-cost, FMEA, and a printable HTML report. Use when asked to tear down a product.
- 力学教学图绘制Produces mechanics teaching figures such as Mohr’s circle, shear/moment diagrams, S-N curves, and free-body diagrams as PNG/SVG. Use when asked to draw or plot a mechanics concept.
- 增材制造熔池几何预测Predicts metal AM melt-pool depth, width, length, and mode (keyhole, lack of fusion, balling, desirable) from laser power, speed, and beam size. Use for LPBF parameter prediction.
- 自然语言参数化CAD建模Turns a plain-English or dimensioned part description into a parametric CadQuery script and exports STEP, STL, and a mass/volume report. Use when asked to model or generate a CAD part.
常见问题
SolidWorks参数化建模自动化能做什么?
Automates parametric pump impeller design and other mechanical modeling tasks through the SolidWorks API. Use when a user wants to script SolidWorks part, assembly, or drawing creation。
如何安装SolidWorks参数化建模自动化?
在科搭 Codar 左侧点击「插件」,在「组件」页签搜索「SolidWorks参数化建模自动化」并安装;在 Claude Code 或 Codex 中可以发送本页的安装提示词,或下载 Skill 包后解压到 ~/.claude/skills 或 ~/.codex/skills。
SolidWorks参数化建模自动化需要哪些权限?
该科研 Skill没有声明额外权限;执行具体操作时仍由 Agent 按自身规则请求确认。
SolidWorks参数化建模自动化经过官方审核吗?
是。SpeedSkills 收录的每个版本都会记录内容摘要与权限声明,当前版本已通过安全审核。