Tutorials CadCraft help Reference

Dynamic blocks

What CadCraft does with dynamic blocks in a DWG: they keep their true names, show the state they were saved in, switch visibility states, change their distances, angles, points, flips, arrays and polar stretches from Properties and their grips, and stay dynamic when saved.

Written for CadCraft 0.12. The same help is inside the app: press F1.

What works

A DWG made with dynamic blocks opens with them working this far:

  • Their true names. A dynamic block is listed in the Blocks panel under its own name ("Receptacle", "Sink"), not as an unnamed *U block.
  • The state they were saved in. Each reference shows exactly what the other program showed: the visibility state it was set to, stretched or flipped as it was saved.
  • Switching the visibility state. Select one reference (or several of the same block), open Properties, and in the Custom section choose another state from the Visibility list. The reference shows that state at once, its attributes too: those the state hides disappear, those it shows appear with their values. A reference keeps every value, so nothing comes back empty; Properties lists the hidden ones marked "hidden". ⌘ZCtrl+Z puts the old state back in one step.
  • Changing a distance, a point or a flip. For a block whose file ties a distance to stretch (and scale), a point to move, or a flip parameter to flip actions, Properties › Custom has a field for each (the distance under the name the block gives it, such as "Window Width"; a point as X and Y; a flip as a box). Type a value and the block changes the way its own actions say, in one undo step. A distance that is not one of the block's allowed values (its limits, its steps or its list) becomes the nearest allowed one. Actions run in this order: stretch, move and scale, then the flips, which turn everything the others made.
  • Rotate, array, polar stretch and lookup (0.12). These come from drawings the other program saved, and each was checked against the copies that program saved for each reference (19 references in all matched to a billionth of a unit). Properties › Custom has:
  • a rotation parameter with a rotate action: the angle in degrees, under the name the block gives it. Type one and the objects the action turns go round the parameter's base point by the change from the block's own angle.
  • an XY parameter with an array action: an X and a Y distance (under the file's names). The block makes as many columns as the X distance holds of the column spacing, and as many rows as the Y distance holds of the row spacing (each rounded down, never fewer than one), starting where the base is and running towards the end; the objects move with the base. Two read-only rows say how many Array columns and Array rows there are. A negative distance is taken as 0.
  • a polar parameter with a polar stretch action that follows the base: a distance and an angle. The objects turn about the end point by the change of angle, and what sits inside the action's frame moves by the change of distance, as the other program does.
  • a lookup parameter with a lookup action: its text shows read only (Properties › Custom). The text is the table's row whose distance, X and Y match the block's, and the lookup's own label when no row does. The table is read from the file; choosing a row from a list to set those values is not there yet (see below). Each is one undo step, saves into the file and comes back when you open it again.
  • Grips. A selected dynamic block shows its own grips where its parameters are: a small triangle for the visibility state (click it for the list of states), arrows at the ends of a distance, a double arrow for a flip, a square for a point, a dot at the end of a rotation's radius, at the end and at the base of an XY parameter, and at the base of a polar parameter. Drag the arrow at the far end of a distance to stretch it (the arrow at the base end moves the near end and leaves the far end where it is); drag a point's grip to move what it moves; drag the rotation dot round the base; drag the XY end to set both distances (the base grip moves the base, and the objects with it, and leaves the end); drag the polar base grip to set its distance and angle from the fixed end; click a flip's grip to flip. The block follows as you drag and snaps to its allowed values; ⌘ZCtrl+Z undoes the whole drag in one step. A grip for a kind of value CadCraft does not read yet says so in the status bar.
  • The other values, read only. Under the fields, Custom also shows the block's alignment angles and any value its file holds that no action of a kind CadCraft reads is tied to, as the drawing holds them.
  • Editing visibility states. Open the block with BEDIT: the editor shows one state, named in the bar above the drawing (pick another there). Type BVSTATE to switch, add (hiding everything, showing everything or keeping what shows), rename or delete a state; BVHIDE hides selected objects in the state showing; BVSHOW shows the hidden ones faded so you can click the ones to bring back. Save the block: references set to a renamed state keep it under its new name, and those set to a deleted state show the first state.
  • Kept dynamic. Saved as DWG in the version the drawing came in, the blocks stay dynamic, with the state you chose: the other program opens them as the same dynamic blocks. Visibility states you edited are saved too: their new names, the states you added and what each one shows.

What is read only, or not there yet

Not there yetInstead, today
Choosing a lookup row from a list to set the distance and the pointThe lookup text shows read only. No drawing we have shows a row being chosen, and what a row's X and Y mean for the point is not shown either, so nothing is set from a row. Your own tables in CadCraft blocks work (PBLOCK).
Array counts for a distance a half step or more past a whole column or row; copies that run left or up; moving the base sidewaysThe drawings we have run right and down and never sit that close to the next whole column, so those cases are unchecked. Check an unusual one against the other program.
A polar stretch that follows the end point, or has a multiplier or angle offset; an object in only one of a polar stretch's two listsLeft as saved, said so in the file's reading: no drawing we have has one.
Limits on a rotation angle, an XY distance or a polar angle; the allowed values of a polar distance are usedThe limits are read but not applied to angles and XY distances: none of our drawings has one that bites.
A polar parameter in a block placed from the library with no values of its ownShown as saved, not changed: the record AutoCAD writes for it has a part nothing in the block defines. Change one value in the other program first, or place the reference from a copy.
Changing distances, points, flips, angles and arrays in a drawing saved in a file format older than 2007The layouts were found in drawings in the 2007 and 2018 file formats. A drawing in an older format is read as before (values show read only).
Making dynamic blocks of the other program's kind (stretch, flip, lookup)Blocks you make in CadCraft are plain blocks; BPARAMETER says so. Your own parameters and several visibility parameters are in the Parameters manager (see "Your own parameters and visibility states" below). Blocks of CadCraft's own kind that stretch, flip, repeat and take sizes from a table are parametric blocks.
Adding or erasing objects of a block with visibility states in the block editorThe block is then saved as a plain block (the editor says so when it closes).
Keeping them dynamic in another DWG version or in DXFThey are saved as plain blocks showing the state you chose, and the save says so.

Construction geometry in the block editor

Guide lines you draw only to build a block (a frame to stretch, a line to mirror about) can be marked in BEDIT: select them and type BCONSTRUCTION. They show grey and dashed while you edit, and the placed block does not draw, pick, snap to, plot or count them. Saving the block keeps them with it, and BEDIT brings them back. In a DWG they are saved hidden and marked with CadCraft's own extended data, so other programs do not draw them; in a DXF only the mark is kept, so other programs show them as ordinary objects.

Your own parameters and visibility states

A block you make in CadCraft can carry its own parameters and several visibility parameters, each with its own states. Type BPARAMS (or BPM) to open the Parameters manager for the block you are editing in BEDIT, for the selected reference's block, or for the block you name.

  • Parameters: a name, a type (number, length, angle, count, yes/no), and a value or a formula over other parameters (w * 2, if(n > 3, 1, 0)). Comes to shows the result. A formula that does not work, or a value that does not fit its type (a count of 1.5), is refused and the manager says why; nothing else changes.
  • Visibility parameters: Add visibility parameter makes one with a first state. Each state can be renamed, removed (the last one stays) or given a "shows when" number. A formula picks the state from the parameters (the state whose number matches, else the state at that place in the list); with no formula, each reference chooses its own.
  • Putting objects in a state: in the block editor select the objects, type BPARAMS and click Put the selected objects here on the state. Objects that no visibility parameter lists always show.
  • This reference: started on a selected reference, the manager also shows that reference's own values and states.

Outside the block editor every change is one undo step. In the block editor the changes are the editor's: Save block keeps them. -BPARAMS asks the same on the command line.

In the file. DWG and DXF keep the parameters, which objects are in which state, and each reference's own values, in CadCraft's own records; open the file again in CadCraft and everything is back. Another program sees each reference as the block with all its objects, since a DWG holds at most one visibility parameter per block of its own kind. A reference that another program moved, or a block whose objects it changed, comes back without the parts that no longer line up (nothing is guessed).