There are a number of methods of creating a user-defined Pen, as follows:
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 Pen - Value 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.
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:
Right-click on a LineString item in the Map Window and select Properties... from the local menu to display the Properties of LineString dialog:
Select the down arrow at the right-hand side of the Pen box and click the Blue pen:
The Properties of LineString dialog will now be shown with Blue selected:
Display the Pen drop-down list and click on the right-arrow at the bottom:
The Edit Pen dialog will now be displayed:
Any change to the Pen will cause the named entry previously shown in the Item Properties of LineString dialog, All tab, Style, Pen-Value, to be replaced with (user defined).
It is not possible to save the new Pen using this method. If the Pen is to be saved you can create a new Pen and copy the code for this Pen to it using the Copy/Paste facility on the Edit Pen dialog, see Pasting JSON into a 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.
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:
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:
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:
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}
Send comments on this topic.
Click to return to www.cadcorp.com
© Copyright 2000-2017 Computer Aided Development Corporation Limited (Cadcorp).