|
| 1 | +# Contributing to GGcode |
| 2 | + |
| 3 | +Thank you for your interest in contributing to GGcode! Your help makes this project better for everyone. |
| 4 | + |
| 5 | +## 📝 How to Contribute |
| 6 | + |
| 7 | +- **Bug Reports & Feature Requests:** |
| 8 | + - Please use [GitHub Issues](https://github.com/1T17/GGcode/issues) to report bugs or suggest features. |
| 9 | + - Include as much detail as possible (steps to reproduce, expected/actual behavior, screenshots, etc). |
| 10 | + |
| 11 | +- **Pull Requests:** |
| 12 | + 1. Fork the repository and create your branch from `main`. |
| 13 | + 2. Write clear, concise commit messages. |
| 14 | + 3. Add tests for new features or bug fixes if possible. |
| 15 | + 4. Ensure all tests pass (`make test` or `npm test` if applicable). |
| 16 | + 5. Open a pull request and describe your changes. |
| 17 | + |
| 18 | +## 🧑💻 Code Style |
| 19 | + |
| 20 | +- **C code:** |
| 21 | + - Use 4 spaces for indentation. |
| 22 | + - Follow existing naming conventions. |
| 23 | + - Add comments for complex logic. |
| 24 | +- **JavaScript/Node.js:** |
| 25 | + - Use 2 spaces for indentation. |
| 26 | + - Prefer `const`/`let` over `var`. |
| 27 | + - Use semicolons and single quotes. |
| 28 | +- **General:** |
| 29 | + - Keep functions small and focused. |
| 30 | + - Write descriptive variable and function names. |
| 31 | + - Document public functions with comments. |
| 32 | + |
| 33 | +## 🧪 Testing |
| 34 | + |
| 35 | +- Run all tests before submitting a pull request. |
| 36 | +- Add new tests for new features or bug fixes. |
| 37 | +- Test both the C and Node.js sides if your change affects both. |
| 38 | + |
| 39 | +## ✍️ Contributing GGcode Scripts & Algorithms |
| 40 | + |
| 41 | +We welcome contributions of new GGcode scripts, toolpath algorithms, and parametric machining logic! Here’s how to make your script contributions clear, reusable, and high-quality: |
| 42 | + |
| 43 | +### Script Style & Best Practices |
| 44 | +- **Use clear variable names** (e.g., `radius`, `feed_rate`, `passes`). |
| 45 | +- **Add comments** to explain the purpose of each section and any tricky logic. |
| 46 | +- **Group related logic** into functions when possible. |
| 47 | +- **Use `note {}` blocks** for runtime comments and debug output. |
| 48 | +- **Prefer parametric/variable-driven code** over hardcoded values. |
| 49 | +- **Document required input variables** at the top of your script. |
| 50 | +- **Include a sample output or screenshot** if possible (in your pull request). |
| 51 | + |
| 52 | +### Example GGcode Script Contribution |
| 53 | +```ggcode |
| 54 | +// Spiral pocketing example |
| 55 | +let center_x = 0 |
| 56 | +let center_y = 0 |
| 57 | +let start_radius = 5 |
| 58 | +let end_radius = 20 |
| 59 | +let step = 1 |
| 60 | +let feed = 300 |
| 61 | +
|
| 62 | +note {Spiral pocketing from R[start_radius] to R[end_radius]} |
| 63 | +
|
| 64 | +for r = start_radius..end_radius step step { |
| 65 | + G1 X[center_x + r] Y[center_y] F[feed] |
| 66 | +} |
| 67 | +``` |
| 68 | + |
| 69 | +### Algorithm Contributions |
| 70 | +- **Describe the algorithm** in your pull request (what problem it solves, how it works). |
| 71 | +- **Add comments** in the code for each major step. |
| 72 | +- **If porting from another language or paper, cite the source.** |
| 73 | +- **Add tests or example GGcode files** in the `GGCODE/` directory. |
| 74 | +- **If your algorithm is complex, consider adding a markdown file explaining it in `/docs` or as a comment block.** |
| 75 | + |
| 76 | +### Where to Put Your Scripts |
| 77 | +- Place example or reusable scripts in the `GGCODE/` directory. |
| 78 | +- Add a short comment at the top with your name/handle and a description. |
| 79 | + |
| 80 | +--- |
| 81 | + |
| 82 | +## 📦 Project Structure |
| 83 | + |
| 84 | +See the [README.md](./README.md#project-structure) for an overview of the project layout. |
| 85 | + |
| 86 | +## 📧 Contact |
| 87 | + |
| 88 | +For questions, reach out to [[email protected]](mailto:[email protected]). |
| 89 | + |
| 90 | +--- |
| 91 | + |
| 92 | +Thank you for helping make GGcode better! |
0 commit comments