mirror of
https://github.com/gumyr/build123d.git
synced 2025-12-15 15:20:37 -08:00
added circuit board example
This commit is contained in:
parent
b18d176706
commit
ca1eed0916
6 changed files with 90 additions and 33 deletions
|
|
@ -1,34 +1,38 @@
|
|||
"""
|
||||
name: "circuit_board.py"
|
||||
title: "Circuit Board With Holes"
|
||||
authors: "Gumyr"
|
||||
license: "http://www.apache.org/licenses/LICENSE-2.0"
|
||||
created: "2022-09-01"
|
||||
modified: "2024-01-27"
|
||||
|
||||
name: circuit_board.py
|
||||
by: Gumyr
|
||||
date: September 1st 2022
|
||||
|
||||
desc:
|
||||
|
||||
description: |
|
||||
This example demonstrates placing holes around a part.
|
||||
|
||||
- Builder mode uses `Locations` context to place the positions.
|
||||
- Algebra mode uses `product` and `range` to calculate the positions.
|
||||
|
||||
license:
|
||||
|
||||
Copyright 2022 Gumyr
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
has_builder_mode: true
|
||||
has_algebra_mode: true
|
||||
image_files:
|
||||
- "example_circuit_board_01.png"
|
||||
- "example_circuit_board_02.png"
|
||||
"""
|
||||
from build123d import *
|
||||
|
||||
# [Imports]
|
||||
from build123d import *
|
||||
from ocp_vscode import *
|
||||
|
||||
# [Parameters]
|
||||
pcb_length = 70 * MM
|
||||
pcb_width = 30 * MM
|
||||
pcb_height = 3 * MM
|
||||
|
||||
# [Code]
|
||||
with BuildPart() as pcb:
|
||||
with BuildSketch():
|
||||
Rectangle(70, 30)
|
||||
Rectangle(pcb_length, pcb_width)
|
||||
|
||||
for i in range(65 // 5):
|
||||
x = i * 5 - 30
|
||||
with Locations((x, -15), (x, -10), (x, 10), (x, 15)):
|
||||
|
|
@ -39,7 +43,7 @@ with BuildPart() as pcb:
|
|||
Circle(1, mode=Mode.SUBTRACT)
|
||||
with GridLocations(60, 20, 2, 2):
|
||||
Circle(2, mode=Mode.SUBTRACT)
|
||||
extrude(amount=3)
|
||||
extrude(amount=pcb_height)
|
||||
|
||||
if "show_object" in locals():
|
||||
show_object(pcb.part.wrapped)
|
||||
show_object(pcb.part.wrapped)
|
||||
# [End]
|
||||
Loading…
Add table
Add a link
Reference in a new issue