Jump to content
Developer Wiki and Function Reference Links ×

Query Edge-Visibility of PolyLine / Polygon


tom_shady

Recommended Posts

i 'm trying to query the Edge-Visibility of the Segments of a Polygon, and indicate it with green (visible) and red (invisible ) Locus. It seems GetVetexVisibility returns wrong results.

any idea to solve this problem ?

Using Vectorworks 10.5, mac os x 10.4.8

PROCEDURE PolyInfo;
{query all vertex-pts of a polygon and draw a point with color according to VertexVisibility - select a polygon / polyline first}
Var
	poly : HANDLE;
	n_vert : INTEGER;
	i:INTEGER;
	pt:VECTOR;
BEGIN
	{ get the handle to the selectet polygon}
	poly := FSActLayer;
	{ get the number of vertices in the path }
	n_vert:= GetVertNum(poly);
	FOR i:= 1 TO n_vert DO BEGIN
		{select color according to Verte}
		GetPolyPt(poly, i, pt.x,pt.y);
		IF GetVertexVisibility(poly,i) THEN PenFore(6) ELSE PenFore(7);
		Locus(pt.x,pt.y);
	END;
END;
Run(PolyInfo);

Link to comment

WORKAROUND:

Thanks to M. Braach - he told me the following work-around:

a opend polygon/line with fillpat 0 has no area...

FUNCTION IsPolyClosed(poly:HANDLE):BOOLEAN;
{ask wether a polyline / Polygon is opend - returns false - or closed - returns true }
VAR
	oldFillPat : LONGINT;
BEGIN
	oldFillPat := GetFPat(poly);
	SetFPat(poly,0);
	IF HArea(poly) = 0 THEN IsPolyClosed := FALSE ELSE IsPolyClosed := TRUE;
	SetFPat(poly,oldFillPat);
END;

Link to comment

Hi tom_shady,

There already is a function:

IsPolyClosed(polyHandle: HANDLE) : BOOLEAN;

so you don't need to redefine it. It is still as yet undocumented but can be found in the SECRET Undocumented Commands file in your personal Plug-ins folder (VWPluginLibraryRoutines.p).

But that only solves part of your problem. A vertex can be set visible and still be unseen, and conversely, set invisible and still be seen. It all depends on what kind of vertex you are referring to and what kind of vertices are in the Polyline. As a general rule, a segment of a Polyline is made visible or invisible from one corner point to the next, including all the control points (Arc, Bezier & Cubic) between them. If any of the control points between 2 corner points is set invisible then the whole segment between the 2 corner points disappears.

Then there are two degenerate cases:

1) A closed Polyline with one corner point and any number of control points. If any vertex is set invisible the whole Polyline disappears, since visibility is applied from one corner point to the next. In this case it's the same corner point, hence it all goes invisible.

2) A closed Polyline with no corner points cannot have invisible segments. It cannot be opened, either.

One more rule:

For a Polyline to be OPEN it must have a corner point on each end.

HTH,

Raymond

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...