Cabinets often have a great number of sections, but they need to be grouped together to define parts of the cabinet (such as a Drawer). To make this more user friendly, each section can optionally be given a “friendly part name”. There are two controls – the actual partname (a string) and a checkbox saying whether to enable this partname. Each of these is formula controllable. See discussion Sections > Import page.
In addition to friendly partnames at section level, subparts can be defined for an assembly using friendly partnames at component level.
Again, there are two controls – one for the friendly subpart name, and a checkbox to enable/disable it. A typical use of this might be to define machining separately for the top face and “6th face” (or bottom face) when doing double sided machining.
With a cabinet having many sections, and only some of them having friendly partnames, it is useful to be able to automatically generate a list of all the partnames. The middleware function machinedpartlist does this.
For example here is its value for a typical 3 drawer cabinet - notice that where parts are nested, it concatenates the part names to create unique strings - e.g. "Drawer 2 - Base"
The machinedpartlist function generates an array, and could be used to populate a friendly page combo used to select a part. If we want to display a part in the preview pane, we can use the middleware function PreviewCurrent("p","MyPart") which selects part same as if the user selected it from the breadcrumb or preview pane list.
We can also directly refer to the friendly partname using it as context for some other function. So we have the middleware context lookup "friendlypart" which can be used anywhere within a section that is a friendly part (e.g. friendlypart.xyz). And there is also the middleware context lookup "toplevelfriendlypart" in an item with nested part definitions (e.g. toplevelfriendlypart.xyz).
We might also want to do some other steps that require knowledge of which section this part came from and so on. For that purpose we have additional functions which generate json data for each friendly part.
There are middleware functions FriendlyPartTree and MachinedPartTree.
These are two forms of the same set of data - the difference being that nested part assemblies are expanded as a full tree in the FriendlyPartTree but flattened by concatenating the part names in the MachinedPartTree - i.e. using the same naming as the MachinedPartList.
As an example, the following is a detailed discussion using the sample files...
Sample files : FriendlyPartTree and MachinedPartTree
Here is the comparison of the sample files for a 3 drawer cabinet from the library.
Using BeyondCompare you can see it is the same data but MachinedPartTree is flattened more when there are friendly parts.
The friendly part tree (on the left side) displays a json tree. Comparing it to the machined part tree on the right, we see it is very similar.
Line 20: There is a part called “Bottom” which is identical in both trees.
- This is because the parts are all in the same section, which as you can see (on line 21) is the section called “Carcass_bottom_bottom”.
Line 29: There is a part with friendly name “Drawer 1”.
- This part is in the section “Carcass_Interior_Draw1” as you can see in the extra line 50 arrowed on the left.
- The section contains sections called “Carcass_Interior_Draw1_Solid_Back” and “… _Base” (lines 32 and 41 on the left).
- These contained sections have parts with friendly names “Back End” (line 31) and “Base” (line 40).
- But these names are not unique – there may be another “Back End” or “Base” in (say) “Drawer 2”.
- In this friendly part tree export, the hierarchy makes it clear that these two parts belong to “Drawer 1”.
Comparing to the machined part tree on the right, we see the naming of these two parts has been flattened to include the parent part name.
So we see the same data, not indented as deeply, and with the two machined part names “Drawer 1 – Back End” and “Drawer 1 – Base”.
In the machined part tree, we still show the actual section containing the parts (e.g. on the right, lines 30 and 39).
But the data on the right does not show the hierarchy, making it easier to go directly to the required section in some cases.
The VSection (shown as “Main” in both trees) and the actual section name (also shown in both the left and right) is enough information to select the section with a given part for any reason.