OpenSCAD How-To - Using sections when designing parts
Note:
These parts are examples only.
When designing parts, it's very convenient to use sections.
Especially when designing parts that will be assembled.
For this, use the Boolean combination - difference or intersection.
You can also slightly shift the section objects to ensure that the assembled parts don't intersect.
I also recommend using the color command.
Then the section cut will have the color of the cutting primitive.
Using the $preview variable, you can control the creation of a part.
In view mode (F5) - section of the part
In rendering mode (F6) - the whole part.
Download the OpenSCAD script, study the example, and use these techniques in your designs.
Feel free to share your questions, comments, and suggestions in the comments.