Jump to content
Developer Wiki and Function Reference Links ×

PIO Upgrades


Recommended Posts

Here is a good one for you PIO developers.

FindAndReplace will find all of an old PIO and insert a new version.

It would be great if some one with a bit of dialog experience could wrap one around this....

PROCEDURE SHELL;

{*/ This Procedure will searh a file and upgrade all instances of a PIO

It can be used for PIO's that have the same parameter Names

**}

PROCEDURE FindAndReplace(oldPIOName:String;upgradeName:String);

PROCEDURE FindReplace(hObject:Handle);

VAR

x1,y1:Real;

hLayer:HANDLE;

LayerName: STRING;

NewObject: Handle;

hNewObject:Handle;

recName:String;

recHand:Handle;

Cnt:INTEGer;

fldName:STRING;

PassText:String;

BEGIN;

GetSymLoc(hobject,x1,y1); {*/Get insert point of existing PIO}

hLayer:=GetLayer(hObject);

LayerName:=GetLName(hLayer);

Layer(layerName); {*/Change to the layer of the Existing PIO}

hNewObject:= CreateCustomObjectN(upgradeName,x1,y1,0,False); {*/Inserts the new Object over the old one}

recName := GetName(GetRecord(hObject, NumRecords(hObject))); {*/Get Record Name of existing PIO-This is entered anyway}

recHand := GetObject(recName); {*/Get Handle to Record}

FOR cnt := 1 TO NumFields(recHand) DO BEGIN {*/For each of the parameters in the object}

fldName := GetFldName(recHand, cnt); {*/Get the Parameter Name}

PassText:=GetRField(hObject,recName,fldName); {*/ Get the Value}

SetRField(hNewObject,upgradeName,fldName,PassText); {*/ Pass the Value into the Parameter of the New Object}

END;

END;

Begin;

ForEachObject(FindReplace, INSYMBOL & INOBJECT & INVIEWPORT & (PON=oldPIOName));

END;

BEGIN;

FindAndReplace('NZ Master Spec Note','NZ Master Spec Legend');

END;

Run (SHELL);

{Code Written By Justin Wright 2010}

{This program is free software: you can redistribute it and/or modify

it under the terms of the GNU General Public License as published by

the Free Software Foundation, either version 3 of the License, or

(at your option) any later version.

This program is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

GNU General Public License for more details.

You should have received a copy of the GNU General Public License

along with this program. If not, see .}

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...