michaelk Posted June 2, 2019 Share Posted June 2, 2019 When creating a custom tool is there a way to show calculated values in the OIP? In the same way the rectangle OIP show ratio, perimeter, and area. Quote Link to comment
Peter Vandewalle Posted June 2, 2019 Share Posted June 2, 2019 Sure, you can just add a fixed text field and fill that with the SetRField command. Quote Link to comment
michaelk Posted June 2, 2019 Author Share Posted June 2, 2019 Aha! That makes total sense. Thanks!!!! Quote Link to comment
Peter Vandewalle Posted June 2, 2019 Share Posted June 2, 2019 Or create a dim, real or integer field, full with SetRField and lock with EnableParameter (I think) Quote Link to comment
michaelk Posted June 3, 2019 Author Share Posted June 3, 2019 Ha. 4 hours ago I thought I understood it. 🙂 Is there a sample .vso that uses one of each kind of parameter? Quote Link to comment
JBenghiat Posted June 3, 2019 Share Posted June 3, 2019 SetRField always requires a string. If you have a dimension or coordinate field, you can set the value as a number using the base document units (inches, mm, etc.), and the field will take care of formatting correctly. Concat() is a good quick and dirty way to format a value as a string. Very useful with things like booleans. To make a field read only, the easiest method is to preface the field name with a single underscore. (Make sure to include the underscore in the SetRField argument). Quote Link to comment
michaelk Posted June 3, 2019 Author Share Posted June 3, 2019 Thanks, Gentlemen. Got the first part working. I can now display calculated values in the OIP. I would like to make these values available in the attached database. SetRField won't (at least for me) set anything but a string. If I use the object definition to create a dimension field, for example, how can I write to that field? Do I create new fields in the record inside the object script and write to that? Quote Link to comment
michaelk Posted June 3, 2019 Author Share Posted June 3, 2019 That wasn't clear at all. Let's say I have calculated numeric and dimension values that I'm writing to static text parameters. Is there away to also write them as real numbers, integers, dimensions to fields in the same record as the object? So their values can be used in worksheets without having to use the Value() function? Quote Link to comment
Peter Vandewalle Posted June 3, 2019 Share Posted June 3, 2019 JBenghiat's reply is the answer to your question.. Quote Link to comment
Pat Stanford Posted June 3, 2019 Share Posted June 3, 2019 SetRField only handles strings. It can be used to write into a field formatted as a number, but you will need to make sure the string passed converts to a valid valuator the format you are writing to. So in an Integer or number field you would have to pass something that VW recognizes as number. 2, 7.123, 0.0008, 17.3", 256.456 mm. Think about it this way, if you can type it into a field and have it respond properly, then that is the string you need to pass to SetRField. GetRField will also return the String equivalent of the number, so if you can you are better off using the Record.Field combination so that you don't have to do any conversion and get the value directly from numeric fields. Quote Link to comment
JBenghiat Posted June 3, 2019 Share Posted June 3, 2019 Just to add, even internally, VW stores field data as strings (at some point you're writing data to the file). You just have to make sure that writing data uses a string that VW can validly convert to the stored data type. When you're not dealing with SetRField, VW does this behind the scenes. Quote Link to comment
michaelk Posted June 3, 2019 Author Share Posted June 3, 2019 Thanks, guys. I think I get it now. 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.