VS:GetCustomObjectColor

From Vectorworks Developer
Jump to: navigation, search

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix


Description

Get an auxilary color index stored in'objectHand' previously with SetCustomObjectColor . Aplication will preserve the color mapped to inTagID.
FUNCTION GetCustomObjectColor(
objectHand  :HANDLE;
inTagID  :INTEGER;
VAR outColorIndex  :INTEGER) : BOOLEAN;
def vs.GetCustomObjectColor(objectHand, inTagID):
    return (BOOLEAN, outColorIndex)

Parameters

objectHand HANDLE Handle to object.
inTagID INTEGER
outColorIndex INTEGER

Return Value

Returns TRUE if the operation was successful.

Remarks

See the <a href=http://www.vectorlab.info/index.php?title=Colors_in_VectorWorks_2008%2B>VectorLab</a> article for more info.

Example

VectorScript

PROCEDURE Example;
VAR
objName :STRING;
objHand, recHand, wallHand :HANDLE;
colorIndexBefore, colorIndexAfter, pRed, pGreen, pBlue :INTEGER;
boo :BOOLEAN;
BEGIN
pRed := 65535;
pGreen := 0;
pBlue := 0;
IF GetCustomObjectInfo(objName, objHand, recHand, wallHand) THEN BEGIN
RGBToColorIndex(pRed, pGreen, pBlue, colorIndexBefore);
Rect(0, 0, 1, 1);
SetFillBack(LNewObj, colorIndexBefore);
IF SetCustomObjectColor(objHand, 1, colorIndexBefore) THEN BEGIN
boo := GetCustomObjectColor(objHand, 1, colorIndexAfter);
AlrtDialog(Concat('before: ', colorIndexBefore, Chr(13), 'after: ', colorIndexAfter));
END;
END;
END;
RUN(Example);

Python

def Example():
	pRed = 65535
	pGreen = 0
	pBlue = 0
	isValid, objName, objHand, recHand, wallHand = vs.GetCustomObjectInfo()
	if isValid:
		colorIndexBefore = vs.RGBToColorIndex(pRed, pGreen, pBlue)
		vs.Rect(0, 0, 1, 1)
		vs.SetFillBack(vs.LNewObj(), colorIndexBefore)
		isValid = vs.SetCustomObjectColor(objHand, 1, colorIndexBefore)
		if isValid:
			boo, colorIndexAfter = vs.GetCustomObjectColor(objHand, 1)
			vs.AlrtDialog(vs.Concat('before: ', colorIndexBefore, vs.Chr(13), 'after: ', colorIndexAfter))
Example()

Version

Availability: from VectorWorks13.0

See Also

VS Functions:

VS:SetCustomObjectColor

VS Functions: [[VS:SetCustomObjectColor]]
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox