Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

GDL: fill selection

runxel
Mentor
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.
AC 24 [ger] | Win 10 | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»
1 ACCEPTED SOLUTION

Solution
Podolsky
Mentor
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 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

Podolsky
Mentor
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
Mentor
Yeah nice idea, but since you can't use it in the param script this approach doesn't work.
Silly.
AC 24 [ger] | Win 10 | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»

Podolsky
Mentor
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
Mentor
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.
AC 24 [ger] | Win 10 | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»

Solution
Podolsky
Mentor
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

runxel
Mentor
Nice GDL Kung Fu.
Love it, thanks Podolsky.
AC 24 [ger] | Win 10 | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»

Lingwisyer
Virtuoso
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.
AC18-23 AUS 7000
Self-taught, bend it till it breaks.
Win10 | E5620 x 2 | 24GB | K2200

Podolsky
Mentor
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

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!