VS:CreateText: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
(add note)
m (Transfer Orso to _c_)
Line 1: Line 1:
{{LocationMain|category=LocationVS|specific=}}
{{LocationMain|category=LocationVS|specific=}}
__TOC__
<vwDoc>
-----------------------------------------------------------------------------------------------------------
<desc>
Returns information on the referenced roof face object.
{| class="wikitable_c"
|+ Table - Roof Miter Styles
! Miter Style !! Constant
|-
| Vertical
| 1
|-
| Horizontal
| 2
|-
| Double
| 3
|-
| Square
| 4
|}
</desc>
-----------------------------------------------------------------------------------------------------------
<def>
<funcDef lang="vs">
PROCEDURE GetRoofFaceAttrib(roofFace:HANDLE; VAR roofRise:REAL; VAR roofRun:REAL; VAR miterType:INTEGER; VAR holeStyle:INTEGER; VAR vertPart:REAL; VAR thickness:REAL);
</funcDef>
<funcDef lang="py">
def vs.GetRoofFaceAttrib(roofFace):
    return (roofRise, roofRun, miterType, holeStyle, vertPart, thickness)
</funcDef>
</def>
-----------------------------------------------------------------------------------------------------------
<params>
<lineList ident=1>
<line>
roofFace
HANDLE
Handle to roof face object.
</line>
<line>
roofRise
REAL
Rise of roof.
</line>
<line>
roofRun
REAL
Run of roof.
</line>
<line>
miterType
INTEGER
Miter style of roof.
</line>
<line>
holeStyle
INTEGER
Miter style of openings.
</line>
<line>
vertPart
REAL
Vertical component of compound miters.
</line>
<line>
thickness
REAL
Thickness of roof.
</line>
</lineList>
</params>
-----------------------------------------------------------------------------------------------------------
<remark>
[[User:CBM-c-|_c_]], 2015.12.18:
Hole style of openings:
: 1 Vertical
: 3 Splayed
: 4 Square Cut
Other authors:
* Returns information about old-style roof objects (single roof faces).
* Returns slope, edge miter style, miter dimensions, and thickness of roof object.{{LocationMain|category=LocationVS|specific=}}
__TOC__
__TOC__
<vwDoc>
<vwDoc>
Line 82: Line 171:
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<remark>
<remark>
([[User:Orso.b.schmid|Orso]], 2015 Dec. 19): If you draw text, it is important to have a proper text size on the document or you'll see the error "An incorrect object is described".
[[User:CBM-c-|_c_]], 2015.12.19: If you draw text, it is important to have a proper text size on the document or you'll see the error "An incorrect object is described".
<code lang="pas">
<code lang="pas">
PushAttrs;
PushAttrs;
Line 105: Line 194:
[[Category:VS Function Reference|CreateText]]
[[Category:VS Function Reference|CreateText]]
[[Category:VS Function Reference:Objects - Text|CreateText]]
[[Category:VS Function Reference:Objects - Text|CreateText]]
See Also [[VS:GetRoofFaceCoords| GetRoofFaceCoords]]() for additional roof face data</remark>
-----------------------------------------------------------------------------------------------------------
<sample>
{{GetRoofProperties}}
</sample>
-----------------------------------------------------------------------------------------------------------
<version>
Availability: from VectorWorks 9.0
</version>
</vwDoc>
[[Category:VS Function Reference|GetRoofFaceAttrib]]
[[Category:VS Function Reference:Objects - Roofs|GetRoofFaceAttrib]]

Revision as of 06:26, 30 December 2020

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

Description

Returns information on the referenced roof face object.

Table - Roof Miter Styles
Miter Style Constant
Vertical 1
Horizontal 2
Double 3
Square 4
PROCEDURE GetRoofFaceAttrib(
roofFace :HANDLE;
VAR roofRise :REAL;
VAR roofRun :REAL;
VAR miterType :INTEGER;
VAR holeStyle :INTEGER;
VAR vertPart :REAL;
VAR thickness :REAL);
def vs.GetRoofFaceAttrib(roofFace):
    return (roofRise, roofRun, miterType, holeStyle, vertPart, thickness)

Parameters

roofFace HANDLE Handle to roof face object.
roofRise REAL Rise of roof.
roofRun REAL Run of roof.
miterType INTEGER Miter style of roof.
holeStyle INTEGER Miter style of openings.
vertPart REAL Vertical component of compound miters.
thickness REAL Thickness of roof.

Remarks

_c_, 2015.12.18:

Hole style of openings:

1 Vertical
3 Splayed
4 Square Cut


Other authors:

  • Returns information about old-style roof objects (single roof faces).
  • Returns slope, edge miter style, miter dimensions, and thickness of roof object.

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

<vwDoc>


<desc> Procedure CreateText creates a new text object in a VectorWorks document. The text object is created using the current pen position and default attributes.</desc>


<def>

PROCEDURE CreateText(
theText :DYNARRAY[] of CHAR);
def vs.CreateText(theText):
    return None

</def>


<params>

theText DYNARRAY[] of CHAR Text string.

</params>


<sample>

VectorScript

PROCEDURE Example;
VAR
    Txt   :ARRAY [1..100] of STRING;
    Outpt :DYNARRAY[] of CHAR;
    i     :INTEGER;
BEGIN
    FOR i := 1 TO 5 DO txt[i] := 'asdf';
    i := 2;
    Outpt := Txt[1];
    WHILE Txt[i] <> '' DO BEGIN
        OutPt := Concat(Outpt, Chr(13), Txt[i]);
        i := i + 1;
    END;
    Layer('Text');
    CreateText(Outpt);
    Layer('Layer-1');
END;
RUN(Example);

Python

def Example():
	txt = []
	for i in range(0,4):
		txt.append('asdf')
	txt.append("")
	i = 1
	Outpt = txt[0]
	while txt[i] != "":
		OutPt = vs.Concat(Outpt, vs.Chr(13), txt[i])
		i = i + 1
		
	vs.Layer('Text')
	vs.CreateText(Outpt)
	vs.Layer('Layer-1')

Example()

</sample>


<seeAlso> VS Functions: VS:BeginText | VS:EndText </seeAlso>


<remark> _c_, 2015.12.19: If you draw text, it is important to have a proper text size on the document or you'll see the error "An incorrect object is described".

PushAttrs;
	NameClass(ClassList(1));
	PenPat(1);
	FillPat(0);
	PenFore(0, 0, 0);
	TextSize(9); { avoid accidental small text size rising the error "An incorrect object is described" }
	CreateText('Text');
PopAttrs;

Version

Availability: from VectorWorks 8.0


See Also GetRoofFaceCoords() for additional roof face data</remark>


<sample>

VectorScript

PROCEDURE Example;

PROCEDURE ShowRoofFaceAttrib(roofFace :HANDLE);
VAR
roofRise, roofRun :REAL; 
miterType, holeStyle :INTEGER; 
vertPart, thickness :REAL;
beg_pt, end_pt, upslope_pt :VECTOR;
Z :REAL;
BEGIN
IF GetObjectVariableInt(roofFace, 172) = 1 THEN BEGIN
GetRoofFaceAttrib(roofFace, roofRise, roofRun, miterType, holeStyle, vertPart, thickness);
Message('roofRise: ', roofRise,
',  roofRun: ', roofRun,
',  miterType: ', miterType,
',  holeStyle: ', holeStyle,
',  vertPart: ', vertPart,
',  thickness: ', thickness);

GetRoofFaceCoords(roofFace, beg_pt.x, beg_pt.y, end_pt.x, end_pt.y, Z, upslope_pt.x, upslope_pt.y);
beg_pt     := beg_pt     * (25.4 / GetPrefReal(152));
end_pt     := end_pt     * (25.4 / GetPrefReal(152));
upslope_pt := upslope_pt * (25.4 / GetPrefReal(152));
Locus(beg_pt.x, beg_pt.y);
Locus(end_pt.x, end_pt.y);
Locus(upslope_pt.x, upslope_pt.y);
END;
END;

BEGIN
 ForEachObject(ShowRoofFaceAttrib, ((T=71)));
END;
RUN(Example);

Python

def ShowRoofFaceAttrib(roofFace):
	if vs.GetObjectVariableInt(roofFace, 172) == 1:
		roofRise, roofRun, miterType, holeStyle, vertPart, thickness = vs.GetRoofFaceAttrib(roofFace)
		vs.Message('roofRise: ', roofRise,
		',  roofRun: ', roofRun,
		',  miterType: ', miterType,
		',  holeStyle: ', holeStyle,
		',  vertPart: ', vertPart,
		',  thickness: ', thickness)
		
		beg_pt, end_pt, Z, upslope_pt = vs.GetRoofFaceCoords(roofFace)
		
			
		
		vs.Locus(beg_pt[0]    * (25.4 / vs.GetPrefReal(152)), beg_pt[1]    * (25.4 / vs.GetPrefReal(152)));
		vs.Locus(end_pt[0]    * (25.4 / vs.GetPrefReal(152)), end_pt[1]    * (25.4 / vs.GetPrefReal(152)))
		vs.Locus(upslope_pt[0]    * (25.4 / vs.GetPrefReal(152)), upslope_pt[1]    * (25.4 / vs.GetPrefReal(152)));


def Example():
	vs.ForEachObject(ShowRoofFaceAttrib, '((T=71))')

Example()

</sample>


<version> Availability: from VectorWorks 9.0

</version>

</vwDoc>