Working with blocks and block attributes

Build a library of reusable blocks, attach attributes to them and turn the attribute values into a report.

Four ways to draft faster in nanoCAD

Build a library of reusable blocks, attach attributes to them and turn the attribute values into a report.

A block groups drawing objects into a single reusable element. Draw a symbol once, then insert as many copies as the project requires.

Many designers use a separate application for electrical schematics. Here we’ll build a block library in nanoCAD for an H-bridge circuit that controls a brushed DC motor.

The reference circuit contains repeated resistors, diodes and transistors. Each symbol has one or two text labels. Some labels vary between instances, such as resistor designators R1 and R2. Others, such as the diode type, can stay the same.

Start by drawing a resistor symbol to the dimensions shown in Figure 2.

Figure 2. Resistor symbol dimensions
Figure 2. Resistor symbol dimensions

Create a block

On the Insert tab, look for the Block and Block Definition panels (Fig. 3).

Figure 3. Block commands
Figure 3. Block commands

Select the resistor symbol and choose Create Block to open the Block Definition dialog (Fig. 4).

Figure 4. Block Definition dialog
Figure 4. Block Definition dialog

Select Scale uniformly and Allow exploding. Under Base point, select Specify on-screen, then click OK.

Choose the left lead as the insertion point (Fig. 5).

Figure 5. Choosing the block insertion point
Figure 5. Choosing the block insertion point

Each resistor needs two labels: its reference designator and its resistance value. Define them as block attributes so you can give each inserted instance different values while keeping the same symbol.

Define block attributes

Start with the resistor’s reference designator.

Run the attribute definition command (ATT) to open the Attribute Definition dialog.

Enter the attribute name, prompt and default value (Fig. 6).

Figure 6. Attribute Definition settings
Figure 6. Attribute Definition settings

Set the text justification to Middle Center so the attribute sits in the center of the resistor symbol. Figure 7 shows the other options.

Leave the mode options unchecked in this example. The text should remain visible, its value should vary between resistors, and no extra verification or preset value is needed. We also use single-line text and leave its position unlocked.

Attribute presentation modes
Figure 7. Modes

Click OK and specify the attribute’s insertion point (Fig. 8).

Block attributes
Figure 8. Attribute

Create a second attribute for the resistance value. Next, add both attributes to the block definition.

Add the attributes to the block

Explode the resistor block back into drawing objects so you can include the designator and value in its definition.

Select the resistor geometry and both attributes, then run Create Block again.

Fig. 9. Block Definition dialog box
Fig. 9. Block Definition dialog box

After you specify the insertion point, enter R8 as the designator and 10 Ω as the resistance. Click OK (Fig. 10).

Figure 10. Entering the block attribute values
Figure 10. Entering the block attribute values

The resistor block now contains both attributes (Fig. 11).

Figure 11. Finished resistor block with attributes
Figure 11. Finished resistor block with attributes

Define the remaining symbols and attributes in the same way until the library contains all the parts for the H-bridge (Fig. 12).

Figure 12. Block list
Figure 12. Block list

Insert the blocks

Insert the blocks to reproduce the H-bridge schematic. Figure 13 shows the Insert Block dialog.

Figure 13. Insert Block dialog box
Figure 13. Insert Block dialog box

Tool palettes

Add the blocks to a tool palette so they are available in other drawings without recreating them.

The palette files are stored in this folder:
%AppData%\Nanosoft\nanoCAD x64 21.0\ToolPalette

Add the blocks to a tool palette so they are available in other drawings without recreating them.

Run TOOLPALETTES to open the Tool Palettes window.

Right-click My Palettes to create a new tool set. Drag your blocks onto it (Fig. 14).

Figure 14. Tool palette with the finished symbols
Figure 14. Tool palette with the finished symbols

You can now assemble the circuit in model space and enter the attribute values for each symbol.

Figure 15. Completed H-bridge schematic
Figure 15. Completed H-bridge schematic

Remove unused blocks

Unused block definitions increase the file size. Run BLOCKS to see the block names and the number of references to each definition.

Figure 15. Block list
Figure 15. Block list

The test block has no references. Select it and click the delete button in the upper right.

Blocks can also contain hyperlinks, be written to disk or supply attribute data for reports such as bills of materials.

Enjoy the tutorials.

Try nanoCAD with your own projects

Open your own DWG files and see how nanoCAD fits into your work.

Start your free 30-day trial

Related articles

View all articles