The Global Archicad Community

Stay informed. Get help. Share your knowledge.

Topics specific to the scripting and development of Library Parts and Libraries using Param-O or the Geometric Description Language – GDL. (Example: How do you use “REQUEST” GDL commands?)

Moderators: ejrolon, Barry Kelly, Karl Ottenstein, LaszloNagy, Gordana Radonic, nbalogh, gkmethy, mnguyen, rmasaki, Akos Somorjai, Peter Baksa, Csilla Mai

User avatar
By runxel
#326063
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.
User avatar
By Barry Kelly
#326066
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.
User avatar
By Podolsky
#326067
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.
User avatar
By runxel
#326079
Yeah nice idea, but since you can't use it in the param script this approach doesn't work.
Silly.
User avatar
By Podolsky
#326086
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?
User avatar
By runxel
#326098
Podolsky wrote: Mon May 17, 2021 9:46 pm 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.
User avatar
By Podolsky
#326102
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:
Code: Select all
DIM fillsIndexArray[]
DIM fillsNameArray[]

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

VALUES{2} "customFill", fillsIndexArray, fillsNameArray
And then this code in User Interface script:
Code: Select all
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[m]=n
				fillsNameArray[m]=name
				pixIdxArray[m]=''
				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.
Attachments
Screenshot 2021-05-18 at 11.05.25.png
Screenshot 2021-05-18 at 11.05.25.png (202.77 KiB) Viewed 129 times