We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

GDL
About building parametric objects with GDL.
SOLVED!

GDL: fill selection

runxel
Legend
Is there any way to let the user have select only solid fills (those with %, also named translucent fills)?
I know there is FILLTYPES_MASK, but thats the type of the usage of the fill.

Of course I could just loop through all fills and hope the user has named the fills in a way I can filter them out. But that is too risky for an object that's not used inhouse alone.
Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Podolsky
Ace
I know how to do it!

First set a variable for the fill as integer (small cubes icon). The name of variable is customFill

Then write this code in parameter script:
DIM fillsIndexArray[]
DIM fillsNameArray[]

FOR n=1 TO 1000
	fillsIndexArray=n
	fillsNameArray=STR(n, 1, 0)
NEXT n

VALUES{2} "customFill", fillsIndexArray, fillsNameArray
And then this code in User Interface script:
DIM fillsIndexArray[]
DIM fillsNameArray[]
DIM pixIdxArray[]

m=1

FOR n=1 TO 1000

	rClass = REQUEST ("class_of_fill", n, class)
	IF rClass THEN
		IF class=3 THEN	
			rName = REQUEST ("Name_of_fill", n, name)
			IF rName THEN
				fillsIndexArray=n
				fillsNameArray=name
				pixIdxArray=''
				m=m+1
			ENDIF
		ENDIF
	ENDIF

NEXT n

UI_INFIELD{4} "customFill", 5, 65, 200, 20,
				8, "",
				0,0,0,0,0,0,
				pixIdxArray, fillsNameArray, fillsIndexArray
Result is showing on preview image. You can also add additional code to re-organise fills list, that it would follow alphabetical order. If you need help with that - I can share the script about it too.

View solution in original post

9 REPLIES 9
Barry Kelly
Moderator
Will this help? ...

n = REQUEST ("class_of_fill", index, class)
Returns class of the fill identified by index in the class variable. Causes warning if used in parameter script.


Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Podolsky
Ace
Maybe you can use request:

n = REQUEST ("class_of_fill", index, class)

So, you need to scan all fills, detect only fills with class = 3 (translucent), record all into array and use array in VALUES{2} to limit fills selection.
runxel
Legend
Yeah nice idea, but since you can't use it in the param script this approach doesn't work.
Silly.
Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»
Podolsky
Ace
To be honest - this limitation when some requests are not working in Parameter script make a lot of nice things to do in GDL impossible.
In earlier versions this limitation did not exist. I'm wondering, why not to work on this issue and solve it one day? Post a wish?
runxel
Legend
Podolsky wrote:
To be honest - this limitation when some requests are not working in Parameter script make a lot of nice things to do in GDL impossible.
True .... 😞

Anyway, I "solved" this issue by defining a translucent fill and the user can determine the transparency.
But man, still a silly way.
Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»
Solution
Podolsky
Ace
I know how to do it!

First set a variable for the fill as integer (small cubes icon). The name of variable is customFill

Then write this code in parameter script:
DIM fillsIndexArray[]
DIM fillsNameArray[]

FOR n=1 TO 1000
	fillsIndexArray=n
	fillsNameArray=STR(n, 1, 0)
NEXT n

VALUES{2} "customFill", fillsIndexArray, fillsNameArray
And then this code in User Interface script:
DIM fillsIndexArray[]
DIM fillsNameArray[]
DIM pixIdxArray[]

m=1

FOR n=1 TO 1000

	rClass = REQUEST ("class_of_fill", n, class)
	IF rClass THEN
		IF class=3 THEN	
			rName = REQUEST ("Name_of_fill", n, name)
			IF rName THEN
				fillsIndexArray=n
				fillsNameArray=name
				pixIdxArray=''
				m=m+1
			ENDIF
		ENDIF
	ENDIF

NEXT n

UI_INFIELD{4} "customFill", 5, 65, 200, 20,
				8, "",
				0,0,0,0,0,0,
				pixIdxArray, fillsNameArray, fillsIndexArray
Result is showing on preview image. You can also add additional code to re-organise fills list, that it would follow alphabetical order. If you need help with that - I can share the script about it too.
runxel
Legend
Nice GDL Kung Fu.
Love it, thanks Podolsky.
Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»
Lingwisyer
Guru
Podolsky wrote:
You can also add additional code to re-organise fills list, that it would follow alphabetical order. If you need help with that - I can share the script about it too.

Hey Podolsky, how would you go about achieving this? Also, is there a way to check if a fill exists or not?

I saw this thread but do not get what is happening...



Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660
Podolsky
Ace
Lingwisyer wrote:
Podolsky wrote:
You can also add additional code to re-organise fills list, that it would follow alphabetical order. If you need help with that - I can share the script about it too.

Hey Podolsky, how would you go about achieving this? Also, is there a way to check if a fill exists or not?

I saw this thread but do not get what is happening...



Ling.
Please look as Schedule Setting Tool from my library, at the end of Parameter script there is subroutine that organising arrays in alphabetical order.

https://archicad-talk.graphisoft.com/viewtopic.php?f=37&t=72947