2D parametric blocks

Context

Parametric blocks are blocks which contain not only pure geometry, but also some metadata, which affect the geometry (e.g., their size, visibility). The metadata controls the way the components of the block behave. Thus, the size and appearance of a parametric block can be modified without editing the block definition.

Workflow

This workflow will describe one way of working with 2D parametric blocks, making use of some advanced features that BricsCAD offers for creating these blocks.

One use case of the 2D parametric blocks is architectural symbols. The symbol used in this example is a simple parametrized door.

Note: In this case, the block will be built in a separate drawing. Then, it will be inserted in the target drawing using the INSERT command and choosing the file from browser.

Creating the geometry

To ensure all the necessary tools are easily accessible, it is helpful to set the workspace to Drafting.

The geometry will contain the entities to represent three distinct configurations of the door. These configurations are called visibility states. When creating the geometry, the entities from all the states will be drawn.

For this example, the block geometry will look like this:

Adding the visibility states

To start creating the visibility states, go to the Parametric tab of the ribbon. In the Parametric Blocks panel, click the button Visibility States Panel.

For more information about the visibility states, see the article Visibility States Panel.

Next, three states of the door symbol will be defined. These states are created as values of a visibility parameter. This operation can be achieved using the Visibility States Panel mentioned above.

The workflow for this task is like this:

  • Create a visibility parameter.
  • Add three states to it.
  • Add entities to the parameter.
  • Make attached entities visible or invisible depending on which state is active.

To add the visibility states to the block, follow the next steps:

  1. Open the block drawing.
  2. To add a visibility parameter, click on the + (plus) round blue button at the bottom of the Visibility States panel. A new parameter will be created, and its name will be available to edit. For this example, the visibility parameter will be called Angle.
  3. To add a state, click on the button +Add state under the parameter name label. A new state is created, and its name is available for edit. For this example, the names of the three states are, Open, Half Open and Closed.
  4. To add entities to a state, click on the ... button at the right end of the state name label. From the contextual menu, choose Make entities visible. This option allows to select the entities that will be made visible for this state only. For the other states the entities selected at this step will not be visible. To attach entities to the three states, follow the next steps:

    • Make the Open state active and add the vertical line and the larger arc.
    • Make the Half Open state active. The entities added to Open will be hidden. Add the slanted line and the smaller arc.
    • Make the Closed state active. The entities for Open and Half Open will be hidden. Because the entities for the other states have been automatically hidden when they were attached, there are no changes to be made. This happens for the last state of the parameter.
    Note:
    1. When a certain visibility state is active, to view the entities that are hidden for that state, click the "..." button at the top right corner of the panel and then click Show invisible. The hidden entities will be shown in light blue. To hide them again, untick the Show invisibleoption.
    2. There is a second way to add entities to a visibility parameter. Click the arrow button (>) at the right of one of the states' labels. A new state specific panel opens. Then click the blue plus (+) button at the bottom of the panel and select the desired entities.
    3. To remove entities from a visibility parameter, click the arrow button (>), then click the gray minus (-) button and select the entities to be removed from the parameter.
    4. If, by mistake, some entities are specified to be visible in all the states of the parameter, they will appear in the state specific panel with the label Visible for all states of this parameter. These entities are redundant, and they should be removed from the parameter.
    5. To remove many entities at once, select them using the Shift key. Then, click the "..." button and from the menu, select Remove from parameter.
    6. To edit the visibility of the entities for a certain state, make the state active and click the arrow button (>). The state specific panel opens and there is displayed a list containing the entities that are attached to the parameter. At the left side of each entity label, there is an eye icon. If the eye icon has a slanted line over it, then the entity is hidden for that state. Clicking on that icon will toggle the visibility of that entity.

    This is how the block will look for each visibility states that were defined:

  5. Save the block drawing.
  6. Insert the block into the target drawing.
  7. To change the visibility state, follow these steps:
    • Select the block.
    • Open the Properties panel and go down to Parameters section.
    • Select a state from the visibility parameter drop-down list.

Adding the Reference Curves

Reference curves are entities which are put on the REFERENCE_CURVES layer. These specific entities of a block will be used to align it with entities in the target drawing. The alignment will take place during the insert operation.

The block will be placed in the desired position without the need of further editing operations as moving or rotating.

For more information on reference curves, see the article Fuzzy Insert Guided Workflow.

To add the reference lines, follow the next steps:

  1. Open the block drawing.
  2. Launch the command REFERENCECURVES.
  3. Select the four horizontal lines that represent the wall. These lines are now put on the REFERENCE_CURVES layer, which is purple by default.
  4. Save the block drawing. The block will look like this:
    Note: At this stage, the block will snap the reference curves to similar curves in the target drawing. For this case, the block contains two times two parallel lines, with an offset distance of 300 mm. Thus, this block will be dynamically snapped to lines in the target drawing that are parallel with an offset distance of 300 mm.
  5. Insert the block into the target drawing. After a few insertions, the result will be similar to this:

    The insertion process is like this:

    After launching the INSERT command, the Insert Block dialog opens. In the Guided Insert section, make sure the checkbox Use reference curves for insert is checked. Then, and press OK. The block will be loaded and attached to the mouse cursor. When moving in the neighborhood of two lines that match the reference curves in the block, the block will snap to those lines. Here is a capture of this snapping behavior:

    The four blue arrows represent the reference curves in the block. The block will be aligned to matching lines. Moving the mouse along the lines allows to position the block. Left clicking the mouse will insert the block in the drawing, aligned to the matching lines. In this specific use case, the lines in the target drawing will be trimmed between the connection points (i.e., the points at which the reference curves arrows are attached).

    If the lines under the mouse cursor do not match the reference curves, the block can be inserted in the normal way, but will not align with any curves in the target drawing. For this case, if the distance between the parallel lines in the drawing is different than 300 mm (as it is in the block), the reference curves will not snap to those lines.

    Note: The reference curves might not work well with the geometric and dimensional constraints. The behavior of the block when applying reference curves together with constraints is highly dependent on the complexity of the block geometry and the number and type of the constraints.

Adding the flip lines

Another useful feature that can be added to the parametric blocks is to flip the block geometry along certain lines. This task can be achieved using a flip parameter. The flip parameter will mirror the block across one axis. For this example, two flips will be added, mirroring horizontally and vertically.

To have access to the flip functionality, go to the Parametric tab of the ribbon. In the Parametric Blocks panel, click the button Flipline. Another way to achieve a flip operation is by typing the _FLIPLINE command in the command line.

For more information on the flip lines, see the article FLIPLINE command.

To add one flip line, follow the next steps:

  • Open the block drawing.
  • Launch the command _FLIPLINE and draw a vertical line on the center of the block. This command creates a line which is added to the FLIPLINES layer, making the line green.
  • Give a name to the flip parameter. This parameter will be named flip_Horizontally.
  • Using the same process, a new flip line will be defined on the middle of the wall. This will be called flip_Vertically.

    After defining the flip lines, the block will look like this:

  • To simplify the drawing, the FlipLines will be hidden by hiding the FLIPLINES layer.
  • Save the block drawing.
  • Insert the block into the target drawing. After that, the block can be flipped by selecting it and using the flip parameters in the Parameters section of the Properties panel.

Adding the stretch parameter

The stretch parameter works similar to the STRETCH command. It can be useful when there are many entities to be stretched or moved in the same direction, over the same distance, without editing the block. In this case, the stretch parameter can replace several constraints, thus simplifying the drawing and the process of parametrizing the geometry.

Note: The stretch parameter might not work well in combination with the geometric and dimensional constraints. The behavior of the block when applying the stretch parameter together with constraints is highly dependent on the complexity of the geometry and the number and type of the constraints.

For more information on the stretch parameter, see the article PARAMETRICSTRETCH command.

The following steps describe how to add a parametric stretch to a block.

  1. Open the block drawing.
  2. Launch PARAMETRICSTRETCH command. This command can also be launched from the ribbon in a Drafting workspace. See Parametric tab, then Parametric Blocks panel. It can be accessed by typing PARAMETRICSTRETCH in the command line as well.
  3. Create the stretch vector by selecting two points. For this example, the stretch vector will have its base point of displacement in the point marked with 1, and the second point of displacement, in the point marked with 2. See the picture below. For simplicity, the reference curves and the flip lines layers have been hidden.
    Note:
    1. The direction of this vector defines the direction of the stretch, and the length of this vector will be the initial value of the stretch parameter.
    2. If possible, align the vector with an important feature/dimension in the drawing. By doing this, the stretch parameter value will have a clear meaning.
    3. The stretch vector is drawn with a soft red color so it should be easily observed.
  4. Draw the stretch frame.

    The stretch frame can be a polygon or a rectangle. The stretch frame is used to specify which stretch points will be moved when the stretch is applied. Only the points of selected entities (see next step) which lie inside the stretch frame will be moved.

    For this example, the stretch frame will be the rectangle marked with 1. See the picture below.

  5. This step allows to edit the selection of the entities which will be affected when a stretch is applied, if needed. By default, the entities that have stretch points inside the stretch frame are already selected.

    For this example, the default selection includes the lower line and the two side lines of the rectangle. See the highlighted lines marked with 1, 2 and 3 in the picture below.

  6. Give a name to the stretch parameter. For this example, the parameter will be named Thickness.
  7. Save the block drawing.
  8. Insert the block in the target drawing and change the stretch parameter.

    The block on the left has its Thickness parameter set to the default 60 mm. The block on the right has its Thickness parameter changed to 150 mm. This might make sense for insulation purposes, in this use case.

Adding the fuzzy insert guided functionality

To make the door block more flexible/fuzzy, the reference curves will be parametrized, and the surrounding geometry will be constrained to them. As a result, the parametric block will snap to walls with different wall thicknesses in the target drawing.

For more information on this functionality see the article Fuzzy Insert Guided Workflow.

To add the fuzzy insert guided functionality to the block, follow the next steps:

  1. Open the block drawing.
  2. Launch the REFERENCECURVES command from the ribbon or the command line. For this case, the reference lines are already defined.
  3. Select the Parametrize option. This will create the parameters between the reference curves (see the panels Parameters & Constraints or Mechanical Browser).
  4. Add constraints to attach some entities to the parametrized reference curves. See the picture below:

    For this case, four coincident constraints were added between the ends of the reference curves and the ends of the two vertical lines that represent the wall break.

  5. Save the block drawing.
  6. Insert the block into the target drawing. This time, due to the parameters attached to them, the reference curves will also snap to the inner walls which have a different thickness. See the picture below.