Learn what a custom block is and how to:
This article uses a Custom Block to create our desired outcome. If you are new to using Custom Blocks, learn how to import, modify, and update them with the following resources:
- Learning Center course:
Custom blocks are notebooks with defined outputs and custom inputs with descriptions packaged into a single block to reuse in notebooks.
To create a custom block:
1. Create a workflow in the “Body” of a new notebook.
2. Identify the parameters that will serve as Inputs to the custom block, and there are different ways to make them inputs.
- Move them to the “Inputs” section of the notebook.
- Drag and drop Variables into the Inputs section.
- Right-click and select “Make model input” to move to-be variables out of the body into the Inputs section.
3. Identify the output that will be accessible once compiled into a custom block. To add an output, drag the block containing the output into the “Output” section of the notebook or type the object’s name in the Output section text field. Both of these methods will produce an output variable chip.
4. Name your custom block by double-clicking the name at the top of the notebook "Notebook Name". This name is independent of the nTop file name.
5. Once inputs and output are defined, save the file.
Best Practices for custom blocks:
Notebook Name and File Name
To ensure clarity, a Custom Block’s File Name should be the same as its Notebook Name. The File Name / Notebook Name should describe the function of the block as distinctly and succinctly as possible.
Acceptable Custom Block Names
- Mirror Implicit Body
- Mesh Triangle Selection
- Filter Mesh
- Centroid of 3 Points
- Scale Body [Non-Uniform]
- Boolean Intersect [Listless]
Ineffective Custom Block Names
- mirror implicit body <- Improper capitalization scheme
- Lattice Fill & Shell Compound Block <- Mentions compound block nature
- Better Translate <- Extraneous descriptor
- Boolean Intersect (Listless) <- Parentheses usage (creates confusion with lists)
A Custom Block’s Description should be written in easy terminology to promote clarity and understanding. A good description should address the following:
- What does the Custom Block do?
- What kind of output can a user expect from using the Custom Block?
- Are there circumstances or modifiable inputs that can greatly impact the speed/efficiency of the Custom Block?
- Are there significant circumstances where the Custom Block will not work?
Acceptable Description for a “Mirror Implicit Body Block”
- This Custom Block mirrors an Implicit Body across the selected plane. The original object is not preserved.
Ineffective Description for a “Mirror Implicit Body Block”
This Custom Block mirrors the input object across the input plane. <-
The description is technically correct, but vague and does not address potentially pertinent specifics like the preservation of the original object.
- This Custom Block mirrors the input Implicit Body object across the input plane through a remap. The accuracy of the bounding box is not retained due to the remap, so the tolerance of the Refine Bounding Box attempts to fix this as best as possible. This block does not work on Spatial3D objects that are not Implicit Bodies. The original Implicit Body is not preserved. <- Description is extremely technical and references nuances involving blocks used internally. This can be acceptable for more complex blocks with nuanced outputs, but the Mirror functionality has an expectation of functional simplicity. Also, constantly referencing types is redundant when an Input/Output Type diagram is provided. Use your best judgment.
A Custom Block’s Input and Output Variable Names should very briefly describe how it will be used in three words or less. Capitalization of Input Variable Names should match native block input capitalization schema. (First word capitalized only)
Acceptable Custom Block Input Variable Names
- Implicit body
- Feature tolerance
- Mesh list
Ineffective Custom Block Input Variable Names
- Implicit Body <- Improper capitalization scheme
- Feature tolerance for voxel grid <- Too descriptive (will be truncated and not visible)
- Displacement vector field <- Possibly too long (will be truncated and not visible)
A Custom Block’s Input and Output Descriptions should indicate what kind of values should be used for the input. Input Description is a good place to be verbose where the Input Variable Name could not. A good input description should address the following if pertinent:
- What units are compatible with this input?
- What range of values should a user use?
- Are there inputs that can greatly impact the speed/efficiency of the Custom Block?
- Are there significant inputs that should be avoided?
Acceptable Description for a “Scalar Input Variable”
- Tolerance of conversion is determined by the distance of the resultant Implicit body to the surface of the CAD body. “0.01 mm” is an acceptable value for CAD bodies with planar surfaces. “0.001 mm” or smaller should be used if the CAD body has contours or curvature.