VS:PenPatN: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
(negative index doesn't always start with -1)
(expand)
Line 33: Line 33:
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<remark>
<remark>
([[User:Orso.b.schmid|Orso]] 2016.02.29): (Orso 2016.02.29): VS:FPenPatN requires a name list index, while the older routine VS:PenPat requires the dash style index. Please mind that a document doesn't necessarily have dash styles loaded.


([[User:Orso.b.schmid|Orso]] 2016.02.29): You can't pass numbered indexes starting from -1 as in the past before VW 18 (introduction of named dash styles, with a place in the name list), you need to pass a valid negative index, this could start by any value. VW 2014 will have a delayed crash upon passing a non valid index. Please also mind that a document doesn't necessarily have dash styles loaded.
<code lang='vs'>
PenPatN(-Name2Index('ISO-02 Dashed')); { makes 'ISO-02 Dashed' as the active pen pattern }
</code>
</remark>
</remark>


Line 43: Line 46:
{ uses fill pattern 25 as the active pen pattern }
{ uses fill pattern 25 as the active pen pattern }


PenPatN(-10);
indx := Name2Index('ISO-02 Dashed');
{ sets the line type with the index of 10 as the active pen pattern }</code>
PenPatN(-indx);
{ makes 'ISO-02 Dashed' as the active pen pattern }
</code>
</sample>
</sample>



Revision as of 15:33, 1 March 2016

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

Description

Procedure PenPatN sets the active pen pattern (line style) for the document.

If patNumber is in the range 0 to 71 the linestyle will be set to the corresponding fill pattern. A negative value, will set the linestyle to the line type resource whose index is the negative of the value.

PROCEDURE PenPatN(
patNumber :LONGINT);
def vs.PenPatN(patNumber):
    return None

Parameters

patNumber LONGINT Pattern/linestyle ID value.

Remarks

(Orso 2016.02.29): (Orso 2016.02.29): VS:FPenPatN requires a name list index, while the older routine VS:PenPat requires the dash style index. Please mind that a document doesn't necessarily have dash styles loaded.

PenPatN(-Name2Index('ISO-02 Dashed')); { makes 'ISO-02 Dashed' as the active pen pattern }

Example

PenPatN(25);
{ uses fill pattern 25 as the active pen pattern }

indx := Name2Index('ISO-02 Dashed');
PenPatN(-indx);
{ makes 'ISO-02 Dashed' as the active pen pattern }

Version

Availability: from Vectorworks 2013

See Also

VS Functions:

VS:FPenPatN

VS Functions: [[VS:FPenPatN]]