Using Geometry Parts
If you consider the geometry sequence as a computer program, a geometry part corresponds to a subroutine, function, method, or procedure in a programming language. In other words, a geometry part is a geometry sequence whose input is a set of input parameters (having numerical values) and whose output is a set of geometry objects, making it possible to create instances of these parts using different input parameter values and different orientation and position in the overall geometry.
You can call the geometry part (that is, create an instance of the part) with new values of the input parameters (arguments). You can call it several times, and the calls can be nested. You can also include several variants of a part in an MPH-file, which makes it possible to choose from those part variants when loading the part.
Creating or loading a Geometry Part
The geometry parts appear under the Geometry Parts node (), located under Global Definitions () in the model tree, so they are not attached to a specific model component. To create a part, right-click the Global Definitions node, and then, from the Geometry Parts submenu, select 3D Part, 2D Part, or 1D Part. If a Geometry Parts node () exists, you can also right-click it to add a 3D Part, 2D Part, or 1D Part. To parameterize the geometry part you can use global parameters and input parameters (arguments), which you add in the Part node’s Settings window (see Geometry Part Settings). A Local Parameters subnode is added by default (see Local Parameters).
Within the part you can use parameters in expressions, just like you use global parameters in a geometry sequence. If an input parameter or a local parameter has the same name as a global parameter, the input parameter or local parameter is used; that is, the global parameter is shadowed within the part. You add geometry features to the part as usual. There is also a View node with view settings (see User-Defined Views) below the geometry feature nodes. When defining a geometry part, you can specify colors for the selections in the same way as for other geometry sequences. These color settings will then be transferred to the part instances selections.
Local Parameters
Use the Local Parameters node () to specify parameters that are used within the part but should not be specified by users of the part.
A Local Parameters node is always added to a Part. If you delete the node, you can either right-click a Part node to add a Local Parameters subnode, or select to add it from the Programming menu () in the Geometry toolbar. There can be at most one such subnode for each Part node.
In the Local Parameters subnode, you can add parameters that are locally available for that particular geometry part (in addition to global parameters, which are also available). The Settings window is identical to the one for a global Parameters node (see Parameters).
Loading Geometry Parts
You can load one or more geometry parts from a Model MPH-file, which can contain a number of parts and serve as a part library (see Part Libraries):
In the Geometry ribbon toolbar, in the Parts section, click the Load Parts () menu, or from that menu, choose Load Part () or Load Part From () to load geometry parts using a Load Parts window or from an MPH-file in a Model Manager database using the Select Model fullscreen window.
Right-click the Global Definitions node, and then, from the Geometry Parts submenu, select Load Parts () (or, if it exists), right-click the global Geometry Parts node () and select Load Parts () from the context menu). You can also select Load Part From () to load geometry parts from an MPH-file in a Model Manager database using the Select Model fullscreen window.
Loaded geometry parts also appear in the Auxiliary Data window.
Using Load Part
Then, in the Load Part window that opens, browse to a filename and click Open. The file is scanned for geometry parts. It is not possible to load a part that is linked into the MPH-file. Such a part should be linked directly from the MPH-file where it is defined. If there is just one linkable part, it is added under the Geometry Parts node. If the file contains more than one linkable parts, a Load Part dialog box opens. Select one or more parts from the list of available parts. Finally click OK. The selected parts are added under the Geometry Parts node. For information about the settings for these loaded geometry parts, see Loaded Part Settings.
Using Load Part From
Then, in the Select Model fullscreen window that opens, click the Browse button () and, in the Select Model window that opens, browse to a filename of an MPH-file in a database or on the file system and click Open. From then on, the procedure is the same as in Using Load Part above. A filter is applied to show only models containing reusable geometry parts.
If the parts contain references to global user-defined functions or parameters, those functions and parameters are also inserted in the model under the Global Definitions node. If a function or parameter with the same name already exists in the model, that function or parameter is not copied from the MPH-file.
You cannot modify loaded parts, and their definitions are not displayed in the model tree. If you want to modify a loaded part or see its definitions, open the MPH-file in which the part is defined.
To update a loaded part that has been modified in the MPH-file, click the Reload button in the Settings window’s File section. If the name or the location of the MPH-file has been changed, you can modify the path directly using the Filename field or set the new filename using the Browse button (). Click the Replace from Library button to replace the loaded part with one that is a part in the Part Libraries.
You can call loaded parts from geometry sequences in the same way as ordinary parts.
Creating an Instance of a Geometry Part
In a geometry sequence or part, you can create an instance of a geometry part by right-clicking the Geometry node and selecting a part from the Geometry Parts menu. This adds a Part Instance node (), whose purpose is to build an instance of the part with new values of its input parameters (arguments). You can also change the position and orientation of the resulting part instances. See Part Instance for details.
A Part Instance node can optionally make an instance of a local part instead of a part under Global Definitions>Geometry Parts. To use a local part, select Local part from the Part list in the Settings window for a Part Instance node. In this case, the local part appears beneath the Part Instance node as a Local Part subnode.
Debugging a Geometry Part
Sometimes you want to inspect what happens when you build an instance of a part. To do so, right-click the Part Instance node (), and select Step Into (). This builds all preceding features and shows a copy of the called part beneath the Part Instance node. The copy is identical to the part, except that the input parameters have different values. You can now build features in the copy. You can also try out modifications in the copy. You can then apply the modifications in the part.
If an error occurs when you build the Part Instance, a copy of the called part appears automatically so that you can locate the error.
Busbar Assembly Geometry — with Geometry Parts: Application Library path COMSOL_Multiphysics/Geometry_Tutorials/busbar_assembly_geometry