Jump to content
Developer Wiki and Function Reference Links ×

Edit Dimension Trailer


twk

Recommended Posts

Below is an attempt to write a script that has the user click on a dimension to change its trailer text.

Procedure ChangeDimTrailer;

VAR

h2Dim : HANDLE;

x1,y1 : REAL;

oldTrailer, NewTrailer : STRING;

BEGIN

DSelectAll;

PushAttrs;

GetPt(x1,y1);

h2Dim:=PickObject(x1,y1);

IF h2Dim<>NIL THEN BEGIN

CASE GetType(h2Dim) OF

63 : BEGIN

oldTrailer := GetObjectVariableString(h2Dim,10);

NewTrailer:=STRDIALOG('Type in the New Name for the Trailer', oldTrailer);

END;

END;

END;

SetDimText(h2Dim,Concat(' ',NewTrailer)); {used this instead of setObjectvariable(h2Dim, 10), because that doesnt update the actual dimension object}

PushAttrs;

END;

RUN(ChangeDimTrailer);

Instead what happens is the trailer text gets replaced and is shown however the Show Dim Value in the objInfo pallette is turned off.

Can anyone see why this would happen?

Cheers

Link to comment

Do you have an extra END statement?

There is a limit to the number of characters permitted. Reading from the Function Reference I would say SetDimText is doing exactly what it is supposed to do. Replacing the dimension text.

"Procedure SetDimText will set the dimension text of the referenced dimension to the specified value.

The maximum length for dimension text is 60 characters. The first 30 characters of the specified dimension text string will be displayed in the primary dimension string; the remaining characters will be displayed in the secondary dimension string, if it exists."

Perhaps using SetObjVariableString(Handle,10,'STRING'); followed by ResetObject(Handle);

or SetObjVariableBoolean(Handle,6,TRUE);

Link to comment

Thanks so much Larry, that ResetObject(Handle) did the trick.

I don't believe I have an extra END statement. This works.

Cheers

Upadted Script below

Procedure ChangeDimTrailer;

VAR

h2Dim : HANDLE;

x1,y1 : REAL;

oldTrailer, NewTrailer : STRING;

{DEBUG}

BEGIN

DSelectAll;

GetPt(x1,y1);

h2Dim:=PickObject(x1,y1);

IF h2Dim<>NIL THEN BEGIN

CASE GetTypeN(h2Dim) OF

63 : BEGIN

oldTrailer := GetObjectVariableString(h2Dim,10);

NewTrailer:=STRDIALOG('Type in the New Name for the Trailer', oldTrailer);

SetObjectVariableString(h2Dim, 10, NewTrailer);

END;

END;

END;

ResetObject(h2Dim);

END;

RUN(ChangeDimTrailer);

Edited by TuiWalker
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...