User-defined Pens

Creating a user-defined Pen

Example of creating a user-defined pen

Examples of user-defined Pens

Loading Pens created in Cadcorp SIS version 6

Creating a user-defined Pen

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

Modifying an existing Pen

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

Example:

Copy the Purple Pen from the (standard) library to the (temporary) library and rename it to MyNewPen.

Double-click MyNewPen in the Named Object Libraries tab:

   

The Edit Pen dialog will be displayed:

Editing MyNewPen, as follows:

will cause the name MyNewPen, shown in the Properties of LineString dialog, All tab, to be replaced with (user-defined):

Hover over (user-defined) in the PenValue column to display the JSON for the Pen. The code is view only and can not be copied from here.

MyNewPen will now take on the new characteristics defined in the JSON.

Pasting JSON into a Pen

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

 

Back to top of page

Example of creating a user-defined pen

Select a pen in the Properties of LineString dialog Style tab, click the drop-down arrow and click the right-hand arrow at the bottom of the drop-down list:

The Edit Pen dialog will be displayed:

Make changes to this Pen to create the required pen settings, for example:

Click OK.

In the Properties of LineString dialog Style tab the Pen will now be shown as (user-defined):

The entry in the Properties of LineString dialog All tab, Pen Value column of this newly created user-definedPen will be shown in JSON.

In this example the JSON string is:

{"Pen":{"Style":"Dot","Colour":{"RGBA":[0,160,0,0]}}}

This is only an example and changing other Pen definitions, for example thickness and a different shade of green, could produce code changes similar to:

{"Pen":{"Style":"Dot","Colour":{"RGBA":[0,224,0,0]},"Width":200}}

Note: From Cadcorp SIS 7.0 onwards Pens (and Brushes) are specified in JSON (JavaScript Object Notation). JSON for Pens and Brushes is fully explained on the user-defined Pens page.

Back to top of page

Examples of user-defined Pens

Example 1:

JSON: {"Pen":{"Style":"DashDot","Colour":{"R":0,"G":255,"B":0},"Width":200,"RoundCaps":true}}

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

 

 

Example 2:

JSON: {"Pen":{"Style":"Dash","Colour":{"R":0,"G":0,"B":255,"A":183},"Width":100,"RoundCaps":true}}

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

 

 

Example 3:

JSON: {"Pen":{"Colour":{"R":255,"G":0,"B":0},"Width":150,"RoundCaps":true,"Patterns":
{"Fitted":true,"Repeats":[{"Line":5000,"Gap":2500,"Symbol":"Chevron"}]}}}

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

 

Back to top of page

Loading Pens created in Cadcorp SIS version 6

In Cadcorp SIS V6 user-defined Pens (known as implicit Pens in this version of SIS) were created in a Cadcorp proprietary format.

When loading a Cadcorp SIS V6 user-defined Pen 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 Cadcorp SIS format. Changes made to the Pen using the local Properties/Properties of LineString dialog will not change the properties to the latest SIS format.

In Multi-level Pens the example user-defined multi-level Pen in Cadcorp SIS V6 format would be:

P_SOLID_255:0:0_400_0{ ,Circle,1,2500,1000, ,0} P_SOLID_0:0:0_200R_0{ , ,1,2500,1000, ,0}


Top of page

Send comments on this topic.

Click to return to www.cadcorp.com

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