Jump to content
Developer Wiki and Function Reference Links ×

Trouble with Insert() Procedure


PeterT

Recommended Posts

Hi,

I am trying to write a script that adds a user entered number to the end of a specified text string found on the drawing.

The Message() line I put just before the Insert() line returns the correct values for the variables plndig and plnlbl, but the Insert procedure is not inserting plndig after plnlbl as I wish.

I am not at all familiar with using DYNARRAY of CHAR variables.

It seems I can interchange STRING and DYNARRAY of CHAR variables without errors, but I am a bit confused on the whole thing. I get the script to compile, but it does nothing to the "FLOOR PLAN' text block.

Can Anyone help with what my code is missing?

code:

  

PROCEDURE NumberPlan;

VAR

plnnum: REAL;

FUNCTION PlanNum(lblhndl: HANDLE): BOOLEAN;

VAR

plndig:STRING;

plnlbl: DYNARRAY[ ] of CHAR;

objtype, flrpln: INTEGER;

BEGIN

objtype:=GetType(lblhndl);

IF (objtype = 10) {if a text block}

THEN BEGIN

plnlbl:= GetText(lblhndl);

flrpln:=POS('FLOOR PLAN',plnlbl);

IF flrpln<>0 {if text block contains 'FLOOR PLAN'}

THEN BEGIN

plndig:= Num2Str(0,plnnum);

{Message(plndig, plnlbl);}

Insert(plndig,plnlbl,11); {insert plan number after 'FLOOR PLAN'}

END;

END;

END;

BEGIN

plnnum := RealDialog('Enter the Plan Number', '1 ');

ForEachObjectInLayer(PlanNum,1,0,0);

END;

RUN(NumberPlan);
[/code]

Thanks for any input.

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...