VS:PenFore: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
(add remark about multiple access)
(correct python brakets, add color index access using routine (more secure))
Line 41: Line 41:
==== VectorScript ====
==== VectorScript ====
<code lang="pas">
<code lang="pas">
colorIndex := RGBToColorIndex(65535, 0, 0);
PenFore(65535, 0, 39321); { using RGB values }
PenFore(colorIndex); { alternative: using a color index }
 
PenFore(65535, 0, 39321); { alternative: using an RGB triplet }
colorIndex := RGBToColorIndex(65535, 0, 39321);
PenFore(colorIndex); { using Color Index values }
</code>
</code>


==== Python ====
==== Python ====
<code lang="py">
<code lang="py">
vs.PenFore((65535, 0, 39321))
vs.PenFore((65535, 0, 39321)) # using RGB values
 
colorIndex = vs.RGBToColorIndex(65535, 0, 39321)
vs.PenFore(colorIndex) # using Color Index values
</code>
</code>
</sample>
</sample>

Revision as of 05:10, 19 May 2015

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

Description

Procedure PenFore sets the active pen foreground color for the document. RGB values are in the range of 0~65535.

PROCEDURE PenFore(
color :LONGINT);
def vs.PenFore(color):
    return None

Parameters

color LONGINT RGB color value to be set as active pen foreground.

Remarks

Orso: This Procedure will also accept a single INTEGER Color Palette Index value in lieu of three LONGINT RGB values for the COLOR parameter. The Color index can be obtained with VS:RGBToColorIndex. See remarks under VS:SetPenFore for more infos. On Vectorlab there is a list of all color routines accepting multiple variable type, see: Color Index.

When using this command, you should check for the black background preference setting if you're trying to draw black lines.

Example

VectorScript

PenFore(65535, 0, 39321); { using RGB values }

colorIndex := RGBToColorIndex(65535, 0, 39321);
PenFore(colorIndex); { using Color Index values }

Python

vs.PenFore((65535, 0, 39321)) # using RGB values

colorIndex = vs.RGBToColorIndex(65535, 0, 39321)
vs.PenFore(colorIndex) # using Color Index values

Version

Availability: from All Versions

See Also

VS Functions:

VS:RGBToColorIndex | VS:ColorIndexToRGB

VS Functions:

[[VS:RGBToColorIndex]]

| [[VS:ColorIndexToRGB]]