mirror of
https://github.com/gumyr/build123d.git
synced 2025-12-06 02:30:55 -08:00
Fixed project name and included generator expression rather than list comprehension.
This commit is contained in:
parent
933558fcfc
commit
f1244a574c
1 changed files with 2 additions and 2 deletions
|
|
@ -164,7 +164,7 @@ adds the following attributes to :class:`~topology.Shape`:
|
|||
Iterating Over Compounds
|
||||
************************
|
||||
|
||||
As Compounds are containers for shapes, Build123 can iterate over these as required.
|
||||
As Compounds are containers for shapes, build123d can iterate over these as required.
|
||||
Complex nested assemblies (compounds within compounds) do not need to be looped over with recursive functions.
|
||||
In the example below, the variable total_volume holds the sum of all the volumes in each solid in an assembly.
|
||||
Compare this to assembly3_volume which only results in the volume of the top level part.
|
||||
|
|
@ -179,7 +179,7 @@ Compare this to assembly3_volume which only results in the volume of the top lev
|
|||
assembly1 = Compound(label='Assembly1', children=[Box(1, 1, 1),])
|
||||
assembly2 = Compound(label='Assembly2', children=[assembly1, Box(1, 1, 1)])
|
||||
assembly3 = Compound(label='Assembly3', children=[assembly2, Box(1, 1, 1)])
|
||||
total_volume = sum([part.volume for part in assembly3.solids()]) # 3
|
||||
total_volume = sum(part.volume for part in assembly3.solids()) # 3
|
||||
assembly3_volume = assembly3.volume # 1
|
||||
|
||||
******
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue