Drafting Script Example

Section Markers are custom drafting objects that allow a special set of 2D objects to be managed via a group whose group type is "SectionMarkers". The following example script demonstrates how we can use DW external functions to insert such markers into the active drawing view. After starting the script, the user can set up the look of the markers (color, pen, text height) and insert as many markers as necessary with the same settings. For each section marker, the user can specify which character to display next to the section marker arrows, draw the marker by picking the start point and the end point, and swap the direction of the arrows if needed.

The example script can be found in the following location:

%PMS_RUNDIR%\dw\macro\Examples\SectionMarkerTool.mac

Alternatively, you can copy the script code below and save it in a new .mac file.

To run the script, open a document for editing, select a drawing view from Drafting > Settings > Annotating, and run the .mac file from Import > Run > Drafting Script. As a result, the Section Marker Tool dialog opens, and you can use the following commands.

Create

The Create button first prompts you to specify the character to display next to the two section marker arrows.

When you click OK, you are prompted to pick the start point and the end point of the section marker. The section marker is drawn using the properties defined in the setup, and then the following dialog opens:

  • Done – Completes the current section marker and starts the insertion of another one.

  • Cancel – Cancels the current section marker and starts the insertion of another one.

  • Swap Dir – Swaps the direction of the marker arrows.

Delete

The Delete button opens a list of existing section markers. Select a section marker from the list to delete both the group entity and the 2D objects in that group.

Setup

The Setup button opens a dialog for defining the properties of new section markers:

  • Color
  • Pen
  • Text height

Done

The Done button closes the section marker tool.