twk Posted January 10, 2014 Share Posted January 10, 2014 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 Quote Link to comment
LarryO Posted January 11, 2014 Share Posted January 11, 2014 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); Quote Link to comment
twk Posted January 12, 2014 Author Share Posted January 12, 2014 (edited) 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 January 12, 2014 by TuiWalker Quote Link to comment
Recommended Posts
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.