Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

GetPropertyResultAsFloat

...

Text:

...

Attempts to return the given property value as a floating point value. If the calculated property value can not be converted, the value supplied by Default is returned.

Syntax:

Function: GetPropertyResultAsFloat(ItemPath, PropertyName: String; Default: Double 0): Double;

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

API Calls

Delphi

Code Block
languagedelphi
themeRDark
firstline1
titleUsing IItem Object Model
linenumberstrue
collapsetrue
procedure TForm1.GetSetPoint(sender: TObject);
var
  ps: IPlanSwift;
  area,sect: IItem;
  xs,cx,cy: Extended;
  pgw,pgh,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y: Extended;
begin
//Create the planswift interface
  ps := coPlanswift.Create;
//Create a new Area Item
  area := ps.GetItem('Job\Takeoff');
  area := area.NewItem('Area','SetPointArea');
//Add a Section to the new Area
  sect := area.NewSection('SetPoint Area Section');
//Get the page width and height
  pgw := ps.GetPropertyResultAsInteger(ps.Selectedpage.guid,'PageWidth',0);
  pgh := ps.GetPropertyResultAsInteger(ps.SelectedPage.guid,'PageHeight',0);
//Get the scale of the page... needed to draw area to scale
  xs := ps.GetPropertyResultAsFloat(ps.SelectedPage.guid,'ScaleX',0);
  //Get the Center X and Y pos of the page
  cx := pgw /2;
  cy := pgh /2;
  //Set First point of area of Square
  p1x := cx - 20 * xs;
  p1y := cy - 10 * xs;
  sect.NewPoint(p1x,p1y);
  // Add Second Point
  p2x := cx + 10 * XS;
  p2y := p1y;
  sect.NewPoint(p2x,p2y);
  //Add Third Point
  p3x := p2x;
  p3y := cy + 10 * xs;
  sect.NewPoint(p3x,p3y);
  //Add Fourth Point
  p4x := cx - 10 * xs;
  p4y := p3y;
  sect.NewPoint(p4x,p4y);
  //Show Message to fix first point to create a true square box
  ShowMessage('Now will fix the first point by using set point');
  //Set the proper position of the first point
  p1x := cx - 10 * XS;
  // pass that point to planswift using setpoint
  ps.SetPoint(sect.guid,0,p1x,p1y);
  //Free Planswift
  ps := nil;
end


Code Block
languagedelphi
firstline1
titleUsing PlanSwift Object Model
linenumberstrue

C#

Code Block
languagec#
themeRDark
firstline1
titleUsing IItem Object Model
linenumberstrue


Code Block
languagec#
themeRDark
firstline1
titleUsing PlanSwift Object Model
linenumberstrue

VB/VBA (OLE)

Code Block
languagevb
firstline1
titleUsing IItem Object Model
linenumberstrue


Code Block
languagevb
firstline1
titleUsing PlanSwift Object Model
linenumberstrue

Pascal Scripting (OLE)

Code Block
firstline1
titleItem Object Model
linenumberstrue


Code Block
titleRoot Object Model
linenumberstrue

Pascal Scripting

Code Block
firstline1
titleItem Object Model
linenumberstrue


Code Block
titleUsing the PlanSwift Object Model
linenumberstrue