VS:SetPenFore

From Vectorworks Developer
Revision as of 11:36, 18 May 2015 by Orso.b.schmid (Talk | contribs)

Jump to: navigation, search

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

Description

Procedure SetPenFore sets the pen foreground color of the referenced object. RGB values are in the range of 0~65535.
PROCEDURE SetPenFore(
h  :HANDLE;
color  : LONGINT);
def vs.SetPenFore(h, color):
    return None

Parameters

h HANDLE Handle to object.
color LONGINT RGB color value.

Remarks

(Orso 2015.05.18): Historically this Vectorscript procedure responded to both notations:
  • with a singular color index: SetPenFore(FSActLayer, colorIndex);
  • with three longints: SetPenFore(FSActLayer, 65535, 0, 0);

The corresponding Python function on the other side will only respond to the colorIndex notation:

  • with a singular color index: vs.SetPenFore(vs.FSActLayer(), vs.RGBToColorIndex(65535, 0, 0))

See similar comment for SetFillBack.

SetPenBack, SetPenFore will remove the "ByClass" attribute of the FILL as well. Remember to parse for it and restore it (up to VW 13).


Joel Sciamma 2006.08.14: To have no pen drawn, use SetLW to set the line weight to zero.

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 All Versions

See Also

VS Functions:

VS:RGBToColorIndex | VS:ColorIndexToRGB

VS Functions:

[[VS:RGBToColorIndex]]

| [[VS:ColorIndexToRGB]]
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox