VS:RGBToColorIndex

From Vectorworks Developer
Revision as of 10:36, 12 August 2013 by Root (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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

Description

Procedure RGBToColorIndex converts the VectorWorks palette colors from its' red, green, and blue component values to the colors' palette position index. Parameters red, green, and blue return the color components of the swatch, and parameter color is the palette position ID of the color swatch. RGB values are in the range of 0~65535.

A color table listing with associated index values can be found in the Appendix.

PROCEDURE RGBToColorIndex(
red  :LONGINT;
green  :LONGINT;
blue  :LONGINT;
VAR color  :INTEGER);
def vs.RGBToColorIndex(red, green, blue):
    return color

Parameters

red LONGINT RGB color component value.
green LONGINT RGB color component value.
blue LONGINT RGB color component value.
color INTEGER Color index.

Remarks

See <a href=http://www.vectorlab.info/index.php?title=Colors_in_VectorWorks_2008%2B>VectorLab</a> for more info on color indices in VectorWorks 2008.

Example

VectorScript

PROCEDURE Example;
VAR
red, green, blue, color :LONGINT;
criteria :STRING;
BEGIN
red := 65535;
green := 0;
blue := 0;
RGBToColorIndex(red, green, blue, color);
Rect(0, 0, 1, 1);
SetPenFore(LNewObj, color);
DSelectAll;
criteria := Concat('(INSYMBOL & INVIEWPORT & (PF=', color, '))');
SelectObj(criteria);
Message(criteria);
DeleteObjs;
END;
RUN(Example);

Python

def Example():
	red = 65535
	green = 0
	blue = 0
	color = vs.RGBToColorIndex(red, green, blue)
	vs.Rect(0, 0, 1, 1)
	vs.SetPenFore(vs.LNewObj(), color)
	vs.DSelectAll()
	criteria = vs.Concat('(INSYMBOL & INVIEWPORT & (PF=', color, '))')
	vs.SelectObj(criteria)
	vs.Message(criteria)
	vs.DeleteObjs()
Example()

Version

Availability: from MiniCAD6.0

See Also

Functions:
Functions:
  • [[VS:ColorIndexToRGB| ColorIndexToRGB]]
  • [[VS:ColorIndexToRGBN| ColorIndexToRGBN]]
  • [[VS:RGBToColorIndexN| RGBToColorIndexN]]
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox