VS:GetWallHalfBreakInfo: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
m (1 revision)
(Corrected missing bracket after concat.)
 
Line 91: Line 91:
Locus(endPt.x, endPt.y);  
Locus(endPt.x, endPt.y);  
END ELSE
END ELSE
AlrtDialog(concat'Skipped break nr: ', i));
AlrtDialog(concat('Skipped break nr: ', i));
END;
END;



Latest revision as of 23:52, 29 December 2013

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

Description

Gets the start point, center point and end point of a half break in a wall along the wall line.

FUNCTION GetWallHalfBreakInfo(
wallH :HANDLE;
breakIndex :INTEGER;
VAR startPtX,startPtY :REAL;
VAR centerPtX,centerPtY :REAL;
VAR endPtX,endPtY :REAL) : BOOLEAN;
def vs.GetWallHalfBreakInfo(wallH, breakIndex):
    return (BOOLEAN, startPt, centerPt, endPt)

Parameters

wallH HANDLE
breakIndex INTEGER
startPt REAL
centerPt REAL
endPt REAL

Remarks

This currently fails on Round Walls. (VW 13.01+).

The routine parses wall join breaks, not sym breaks. It will return FALSE on:

  • start and end of wall: they are always the last two of the break count. Eventual caps do not influence the result.
  • inserted symbols/plug-ins: which means you cannot use this routine to (easily) reconstruct the kind of break the inserted symbol or plug-in have.

When the routine returns FALSE the VAR startPt, cenPt and endPt are set to "0,0,0". Mind this. This routine just serves wall-join analyzing.

An example, which you'll like to run on many walls to see how the routine behaves in different conditions. It places loci on all break points (a break point has 3 loci: break's start, center and end). The loci take an incremental color index starting 2 (magenta), in order to better distinguish the breaks between each other.

PROCEDURE xxxxx;
VAR
wallH : HANDLE;

PROCEDURE LocusAtBreakPoints(wallH: HANDLE);
VAR
startPt, cenPt, endPt : POINT;
i, numWallBreaks: INTEGER;

BEGIN
IF GetNumOfWallBreaks(wallH, numWallBreaks)  THEN BEGIN
message(numWallBreaks);
PushAttrs;

i := 0;
WHILE i < numWallBreaks DO BEGIN
i := i + 1;
PenFore(i+2);

IF GetWallHalfBreakInfo(wallH, i, startPt.x, startPt.y, cenPt.x, cenPt.y, endPt.x, endPt.y) THEN BEGIN
Locus(startPt.x, startPt.y); 
Locus(cenPt.x, cenPt.y); 
Locus(endPt.x, endPt.y); 
END ELSE
AlrtDialog(concat('Skipped break nr: ', i));
END;

PopAttrs;
END;
END;
BEGIN
wallH := FSActLayer;
IF (WallH <> NIL) & ((GetType(wallH) = 68) | (GetType(wallH) = 86)) THEN
LocusAtBreakPoints(wallH)
ELSE
AlrtDialog('Select a wall with some breaks or inserted objects');
END;
Run(xxxxx);

Version

Availability: from VectorWorks13.0