User-defined Brushes

Creating a user-defined Brush

Examples of user-defined Brushes

Loading Brushes created in Cadcorp SIS version 6

Creating a user-defined Brush

There are a number of methods of creating a user-defined Brush, as follows:

Modifying an existing Brush

One way to define a User-defined Brush is to modify the settings of a Brush which exists in a New Library, having either been created as a new Brush or copied from the (standard) library.

Example:

Copy the Black Brush from the (standard) library to the (temporary) library and rename it to MyNewBrush.

Either:

or

Either method will display the Edit Brush - MyNewBrush dialog:

Editing MyNewBrush, as follows:

The (default background) drop-down allows you see how the brush will appear against a range of backgrounds, 1:250 000 Scale Raster and OS StreetView® are shown below as examples:

If any changes are made to MyNewBrush, the name in the Properties of Brush dialog will be replaced by (user-defined).

MyNewBrush will now take on the new characteristics.

Pasting JSON into a Brush

A user-defined Brush can also be created by writing the JSON to define the Brush and pasting this code directly into a Brush in an editable library via the Edit Brush dialog, Clipboard - Paste option:

From within the Map Window

Right-click on a Polygon item in the Map Window and select Properties... from the local menu to display the Properties of Polygon dialog:

Display the Brush drop-down list and click on the right-arrow at the bottom to display the Edit Brush dialog:

Any change to the Brush will cause the named entry previously shown in the Item Properties tab, Style, Brush-Value, to be replaced with the JSON for the new Brush.

It is not possible to save the new Brush using this method. If the Brush is to be saved you can create a new Brush and copy the code for this Brush to it using the Clipboard>Copy/Paste facility on the Edit Brush dialog, see Pasting JSON into a Brush.

Back to top of page

Examples of user-defined Brushes

Example 1:

JSON: {"Brush":{"Style":"Hatched","Pattern":"-","Colour":{"RGBA":[255,0,0,0]},"BackgroundColour":{"RGBA":[255,255,0,255]}}}

The above JSON would appear as follows when formatted in a JSON viewer:

Example 2:

JSON: {"Brush":{"Style":"Hatched","Pattern":"X","Colour":{"RGBA":[0,0,0,0]},"BackgroundColour":{"RGBA":[0,255,0,0]},"GapX":2000,"GapY":2000,"HatchX":true,"HatchY":true,"Symbol":"Circle"}}

The above JSON would appear as follows when formatted in a JSON viewer:

Back to top of page

Loading Brushes created in Cadcorp SIS version 6

In Cadcorp SIS V6 user-defined (then called implicit) Brushes were created in a Cadcorp proprietary format.

When loading a Cadcorp SIS V6 implicit Brush the properties will remain in Cadcorp SIS V6 format until a change is made to the code, the properties will then be converted to the current version of SIS format. Changes made to the Brush using the local Properties/Properties of Polygon dialog will not change the properties to the current SIS format.

The following are examples of Brushes defined in Cadcorp SIS version 6:

B_ht_r:g:b_r2:g2:b2 where:

B    means brush
h    hatching pattern: S for solid; H for hollow; or one of +, X, |, -, \, /
t    transparency: T for transparent; or O for opaque
r:g:b    are red, green and blue values from 0 to 255
r2:g2:b2    are red, green and blue values from 0 to 255 which define the background colour (optional).

For example, B_SO_128:0:128 would display areas as solid, opaque purple areas. In addition, hatching patterns, shapes and bitmaps can be appended to the implicit brush string as follows:

B_ht_r:g:b_r2:g2:b2_gapx_gapy_angle_hatchX_hatchY_rotateShape_{pen,shape,bitmap} where:

gapx,gapy    are the gaps between hatch lines, or between shape and bitmap repetitions, in 1/100ths of a millimetre
angle    is the hatch angle, in 1/10ths of a degree
hatchX,hatchY    are boolean flags controlling whether or not hatch lines are drawn
rotateShape    enables the Symbol to be rotated to the hatch angle
pen    is the hatch line Pen
shape    is the repeated Symbol
bitmap    is the repeated bitmap (an Item), scaled to fit into (gapX,gapY), but ignoring the hatch angle


Top of page

Send comments on this topic.

Click to return to www.cadcorp.com

© Copyright 2000-2017 Computer Aided Development Corporation Limited (Cadcorp).