Syntax

code

Function: NewItem(ItemType: String; AName: String = ''): IItem;

Description

Creates a new child item and returns the new item.

Code Reference

  • 1. Navigate to Plugin Store->Tool Manager and create a new Plugin
  • 2. Set the plugin type to Script Code and open the Editor
  • 3. Copy Code into the editor
  • 4. press run

code

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

procedure TForm1.psNewItem(Sender: TObject);

var

  ps: IPlanSwift;

  itm: IItem;

  AreaItem: IItem;

  sect: IItem;

begin

//Create Planswift Interface

 ps := coPlanswift.Create;

 //Get the takeoff (Estimating) tab

 itm := ps.GetItem('Job\Takeoff');

 //Create a New Area Item and Show its Properties

 AreaItem := ps.NewItem(itm.GUID,'Area','My Area');

 //Add A Section to the Area

 sect := AreaItem.NewSection('My Area Section');

 //Turn on Record Mode for that section

 sect.DoRecord;

 //Free Planswift Interface;

 ps := nil;

end;