To open any link in a new tab, preserving your position in the current article, just hold down the <CTRL> key on your keyboard before clicking the link or click using your mouse wheel.

BeginUpdate

BeginUpdate



Signals the beginning of a formula change operation.



Syntax:

Procedure: BeginUpdate;

Code Reference:

  1. Create a New Forms Application
  2. Add a PlanSwift to the References (Planswift_Tlb)
  3. Add a button to the form
  4. Copy code below to the onclick event of the button
  5. Compile and run


API Calls

Delphi

Using PlanSwift Object Model
// PlanSwift code runs: 
PlanSwift.BeginUpdate;
try
  // execute code here...
finally
  PlanSwift.EndUpdate;
end;
// _____________________________________________________________________

// FreshDesk code:
procedure TForm1.psBeginUpdateEndUpdate(Sender: TObject);
var
  ps: IPlanswift;
  page: IItem;
  dimension: IItem;
  section: IItem;
  line: ILine;
  point: IPoint;
begin                                     
  // Create the PlanSwift Interface
  ps := coPlanswift.Create;
  // Put Planswift Interface to Update Mode
  ps.BeginUpdate;                     
  // Get Selected Page
  page := ps.SelectedPage;
  // Call The GetLine Function (See GetLine)
  line := ps.GetLine('Draw Dimension Line');
  // Create a New Dimension Item
  dimension :=page.NewItem('Dimension', 'Demo Dimension Item');
  // PageGUID Must be set to the selected page
  dimension.SetPropertyFormula('PageGUID', pg.GUID);
  // Get The First Point from line
  point :=  line.Point1;
  // Add Start Point to the Dimension Section
  dimension.NewPoint(point.X, point.Y);
  // Get The Second Point from line
  point := line.Point2;
  // Add End Point to the Dimension Section
  dimension.NewPoint(point.X, point.Y);
  // Take Planswift out of Update Mode
  ps.EndUpdate;
  // Clear Planswift Interface
  ps := nil;
end;


C#

Using IItem Object Model
public class PlanswiftApi
{
    private PlanSwift Planswift { get; }
    private IItem SelectedPage { get; set; }
    private IItem Dimension { get; set; }
    private ILine Line { get; set; }
    private IPoint Point { get; set; }

    public PlanswiftApi()
    {
         Planswift = new PlanSwift();
    }


    public void DrawLine()
    {
         // Notify PlanSwift of Item/Property Change
         Planswift.BeginUpdate();
    
         // Get Selected Page in PlanSwift
         SelectedPage = Planswift.SelectedPage();

         // Get Line "Draw Dimension Line"
         Line = Planswift.GetLine("Draw Dimension Line");

         // Create a new Item on the Selected Page
         Dimension = SelectedPage.NewItem("Dimension", "Demo Dimension Item");

         // Set the PageGUID Property Formula to the selected page GUID
         Dimension.SetPropertyFormula("PageGUID", SelectedPage.GUID());

         Point = Line.Point1;
         Dimension.NewPoint(Point.X, Point.Y);

         Point = Line.Point2;
         Dimension.NewPoint(Point.X, Point.Y);

         // Notify PlanSwift that Item/Property has been updated
         Planswift.EndUpdate();
    }
}


public partial class MyForm : Form
{  
    private PlanswiftApi PsApi { get; } 
    public MyForm()
    {
        InitializeComponent();
        PsApi = new PlanswiftApi();
    }

    private void BtnDrawLine_Click(object sender, EventArgs e)
    {
        PsApi.DrawLine();
    }
}


VB/VBA (OLE)

Using IItem Object Model
Coming soon
Using PlanSwift Object Model
Coming soon

Copyright 2023 ConstructConnect