incompatible expressions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-03-10
06:46 AM
- last edited on
2025-02-05
12:25 PM
by
Aruzhan Ilaikova
gives an error incompatible expression
Is there any way to combine numbers and text in a string?
John Hyland : ARINA : www.arina.biz
User ver 4 to 12 - Jumped to v22 - so many options and settings!!!
OSX 10.15.6 [Catalina] : Archicad 22 : 15" MacBook Pro 2019 [/size]
- Labels:
-
Library Part Maker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-03-10 07:06 AM
The first form of the function creates a string from the current value
of the numeric expression. The minimum number for numerical
characters in the string is length, while fractions represents
the numbers following the floating point. If the converted value has
more than length characters, it is expanded as required. If it has
fewer characters, it is padded on the left (length > 0) or on the
right (length < 0).
John I have just copied that from AC help to explain what you have to do, so:
if roof_angle#0 then e=STR(roof_angle,3,2) +"º"
where
"3" stands for the number of digits of the integer part (assumingly 0° - 360°)
"2" stands for the number of digits after fl. point (assumingly 2 )
so result could be something like this 268.32°
...and do not forget to declare variable 'e' as a STRING type in the parameters script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-08-25 08:48 PM
I need to declare a parameter as a STRING.
_______________
MBP OSX 10.15.4 Quad Core Intel i7 2.2hz
AC 17 build 5019
AC 22 build 7000
AC 23 build
AC 24 build 5000
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-08-25 10:26 PM
varName='[any text, I use a space]'It can be in the master or parameter script, or the script in which you are using it. For cases like this I initialize the variable right before I use it, for clarity.
John, you should also investigate the format_string feature of the STR command. It allows you to directly express dimensional data. A little tricky to set up, but powerful. I'll try to post more later.
HTH,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-08-26 05:48 AM
How would you do a number variable?
String is
VARNAME='anynamehere'Number is ??
These Varnames can be written in the mastter script or parameter script, right?
What affect would creating a new parameter in the parameter list do? TThe place wfere you can declare if it is a line type or a material type. You can declare textt here as well.
TIA
_______________
MBP OSX 10.15.4 Quad Core Intel i7 2.2hz
AC 17 build 5019
AC 22 build 7000
AC 23 build
AC 24 build 5000
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-08-26 11:49 AM
Parameters can only be created in the main library part window. Variables can be initialized anywhere, and in fact non-string variables don't need to be initialized. If you use a legal variable name that hasn't been used previously, GDL assumes it's zero and moves on.
String variables need to be initialized, because, as above, a new variable is assumed to be the number zero, not an empty string.
The MATERIAL directive, although it can take an integer argument, will assume the argument is text,
MATERIAL unInitializedVarwill give a 'not found' error, even though the argument is really zero, and you might expect the material to come up 'General'.
DEFINE MATERIAL (e.g.) isn't the same as creating a material-type parameter. It just sets up a local material that can be SET like any other material in the project or in a parameter in the main list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-08-26 03:08 PM
variables can be defined from just about anywhere but parameters can only be defined in the parameter list? (see attached image)
How do you declare a parameter in the Parameter Script window?
And when you do, what is done to tell the difference between a string and a number? How does the PARAMETERS command differ from the VARNAME command?
You mentioned before to use the VARNAME command.
All that is needed to initialize a string variable isWhy did you write the equation as you did? Why the 'any text, I use a space'? Are there two expressions needed to complete the statement?varName='[any text, I use a space]'
What about the way I wrote it?
VARNAME='any text'Could I also write it as
VARNAME=anytextor do I need the quotes only when the string of text has spaces as in the first example, but that both examples will work depending on the string used.
And by using the VARNAME, am I not declaring a string variable or the string itself. What would be the variable in a your example?
In the GDL manual, it states there are four commands which can be used in the Parameter Script: VALUES, PARAMETERS, LOCK, HIDEPARAMETER.varName='[any text, I use a space]'
Just trying to understand all the differences and what the reasons are for it all.
Perhaps I have been doing something wrong for so long and never knew I was.
TIA
_______________
MBP OSX 10.15.4 Quad Core Intel i7 2.2hz
AC 17 build 5019
AC 22 build 7000
AC 23 build
AC 24 build 5000

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2023-03-16 04:35 AM
Reviving this thread,
How do you get this to work with arrays?
name = STR ("%2.0", i) + " " + sg_customName[i][2]
Ling.
AC22-28 AUS 3110 | Help Those Help You - Add a Signature |
Self-taught, bend it till it breaks | Creating a Thread |
Win11 | i9 10850K | 64GB | RX6600 | Win11 | R5 2600 | 16GB | GTX1660 |