Converting integer/numeric data to text data
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2014-11-05 06:32 PM
What I'm trying to create is a label for my roofs. It's a simple triangle with 2 different text values that indicates the roof slope (only 2d). What I've done so far is: I created a new Integer Parameter named as 'Roof Slope' and I'm using that value in order to change the length in the triangle sides and also replace the text accordingly (so far everything works). The problem is that I need that same value from the 'Roof Slope Parameter' to show up also as TEXT, replacing the one of the two originally texts that I have in there. Is there a way to achieve that??
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2014-11-05 08:45 PM
Look into the string functions in the GDL reference guide. The STR and STR{2} functions.
Best regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2014-11-05 10:59 PM
mul2 A/0.474913, B/0.443089 add2 19'-3.5711", -24'-8.9653" pen penAttribute_1 hotspot2 -18'-8.8737", 24'-8.9653" hotspot2 -18'-8.8737", 25'-8.9653" hotspot2 -17'-8.8737", 25'-8.9653" hotspot2 -19'-0.2224", 25'-3.0683" hotspot2 -18'-3.0084", 25'-11.6875" pen penAttribute_2 line_property 0 line2 -18'-8.8737", 24'-8.9653", -18'-8.8737", 24'-8.9653" + (RoofSlope * 1") line2 -18'-8.8737", 24'-8.9653" + (RoofSlope * 1"), -17'-8.8737", 24'-8.9653" + (RoofSlope * 1") line2 -17'-8.8737", 24'-8.9653" + (RoofSlope * 1"), -18'-8.8737", 24'-8.9653" define style{2} "AC_STYLE_1" "Georgia", 8'-1.2222", 0 paragraph "AC_PRG_3" 2, 0'-0.0000", 0'-0.0000", 0'-0.0000", 2'-3.5591" pen penAttribute_3 set style "AC_STYLE_1" "12" endparagraph textblock "AC_TEXTBLOCK_3" 0'-0.0000", 8, 0'-0.0000", 3'-3.3701", 3'-3.3701", 3'-3.3701", "AC_PRG_3" richtext2 -18'-3.0084", 25'-8.9653" - (12" - (RoofSlope * 1")), "AC_TEXTBLOCK_3" paragraph "AC_PRG_4" 2, 0'-0.0000", 0'-0.0000", 0'-0.0000", 3'-3.3701" STR(RoofSlope) endparagraph textblock "AC_TEXTBLOCK_4" 0'-0.0000", 6, 0'-0.0000", 3'-3.3701", 3'-3.3701", 3'-3.3701", "AC_PRG_4" richtext2 -18'-8.8737", 25'-3.0683" - ((12" - (RoofSlope * 1")) / 2), "AC_TEXTBLOCK_4"The problem is in fifth line from the bottom STR(RoofSlope)...Any ideas??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2014-11-05 11:16 PM
The function is: STR (numeric_expression, length, fractions) or STR (format_string, numeric_expression). All explained in the reference guide.
In your case, try something like:
STR(RoofSlope,6,2)Best regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2014-11-05 11:28 PM



- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2014-11-06 12:00 AM
At first glance, the guide is not that friendly. It is more technical sort of writing; but once you get how it is structured, it's an invaluable resource (along with the other GDL books out there).
Best regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2014-11-10 08:06 PM
-If the object is mirrored along the y axis then mirror also the text along it's anchor point (I'm not sure if it keeps the anchor point or I should use one of the hotspots that I have)
-If the object is mirrored along the x axis, then do nothing.
Probably sounds a very easy command but I've tried so many different things without any luck...
Thanks!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2014-11-10 10:36 PM
Sure thing.
It kind of depends how your object is scripted and the parameters you have. A screenshot of the problem and how the object works would help a lot, otherwise is just guessing.
I'm assuming you want readable text? Check if the solution I posted here:
Read the thread and other solutions, and eee if that helps.
Best regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2014-11-11 12:09 AM
mul2 A/0.474913, B/0.443089 add2 19'-3.5711", -24'-8.9653" pen penAttribute_1 hotspot2 -18'-8.8737", 24'-8.9653" hotspot2 -18'-8.8737", 24'-8.9653" + (RoofSlope * 1") hotspot2 -17'-8.8737", 24'-8.9653" + (RoofSlope * 1") hotspot2 -19'-0.2224", 25'-3.0683" - ((12" - (RoofSlope * 1")) / 2) hotspot2 -18'-3.0084", 25'-11.6875" - (12" - (RoofSlope * 1")) pen penAttribute_2 line_property 0 line2 -18'-8.8737", 24'-8.9653", -18'-8.8737", 24'-8.9653" + (RoofSlope * 1") line2 -18'-8.8737", 24'-8.9653" + (RoofSlope * 1"), -17'-8.8737", 24'-8.9653" + (RoofSlope * 1") line2 -17'-8.8737", 24'-8.9653" + (RoofSlope * 1"), -18'-8.8737", 24'-8.9653" define style{2} "AC_STYLE_1" "Georgia", 8'-1.2222", 0 paragraph "AC_PRG_3" 2, 0'-0.0000", 0'-0.0000", 0'-0.0000", 2'-3.5591" pen penAttribute_3 set style "AC_STYLE_1" "12" endparagraph textblock "AC_TEXTBLOCK_3" 0'-0.0000", 8, 0'-0.0000", 3'-3.3701", 3'-3.3701", 3'-3.3701", "AC_PRG_3" add2 -18'-3.0084", 25'-8.9653" - (12" - (RoofSlope * 1")) viewRotation = 0 rrr = request("View_Rotangle", "", viewRotation) mul2 1 - 2*symb_mirrored, 1 if symb_rotangle > 91 and symb_rotangle < 271 then rot2 180 else rot2 0 endif richtext2 0, 0, "AC_TEXTBLOCK_3" del 3 paragraph "AC_PRG_4" 2, 0'-0.0000", 0'-0.0000", 0'-0.0000", 3'-3.3701" STR(RoofSlope,2,0) endparagraph textblock "AC_TEXTBLOCK_4" 0'-0.0000", 6, 0'-0.0000", 3'-3.3701", 3'-3.3701", 3'-3.3701", "AC_PRG_4" add2 -18'-8.8737", 25'-3.0683" - ((12" - (RoofSlope * 1")) / 2) viewRotation = 0 rrr = request("View_Rotangle", "", viewRotation) if symb_rotangle > 91 and symb_rotangle < 271 then rot2 180 else rot2 0 endif richtext2 0, 0, "AC_TEXTBLOCK_4" del 3I've placed also a screenshot that shows the problem when I mirror the object along the x axis.
The script that controls the rotation of my text I found it on the net and after some tries that I did it seems to work but only for the mirroring along the y axis.
I've tried also to replace it with the code that you sent me
===CORRECT TEXT ORIENTATION=== MUL2 1 - 2 * SYMB_MIRRORED, 1 ROT2 -SYMB_ROTANGLE * (SYMB_ROTANGLE <> 0)but I get a message that says "Use of real types can result in precision problems". I clicked "OK" but it didn't work....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2014-11-11 02:03 AM
TEXTBLOCK name, width, anchor, angle........So that might be the problem when mirroring.
It looks like you saved this from the floor plan as an object, right? It would work OK with the original code, but when trying to make it parametric, you need to review the whole thing.
For simple texts like these, I would ditch the paragraph/textblock/richtext scenario, unless you need the options they provide, and use simple TEXT2 commands.