VS:ClipSurface: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
m (1 revision)
 
No edit summary
(2 intermediate revisions by 2 users not shown)
Line 13: Line 13:
<funcDef lang="vs">
<funcDef lang="vs">
PROCEDURE ClipSurface(s1:HANDLE; s2:HANDLE);
PROCEDURE ClipSurface(s1:HANDLE; s2:HANDLE);
</funcDef>
<funcDef lang="py">
def vs.ClipSurface(s1, s2):
    return None
</funcDef>
</funcDef>
</def>
</def>
Line 35: Line 39:
<remark>
<remark>


 
[[google.com]]


ClipSurface is not reliable if the smaller poly is not fully contained within the larger one.
ClipSurface is not reliable if the smaller poly is not fully contained within the larger one.
Line 45: Line 49:
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<sample>
<sample>
==== VectorScript ====
<code lang="pas">
<code lang="pas">
PROCEDURE ClipSurfaceExample;
PROCEDURE ClipSurfaceExample;
Line 61: Line 66:
END;
END;
RUN(ClipSurfaceExample);
RUN(ClipSurfaceExample);
</code>
==== Python ====
<code lang="py">
def ClipSurfaceExample():
vs.DSelectAll()
vs.CallTool(-203)
h1 = vs.FSActLayer()
vs.DSelectAll()
vs.CallTool(-203)
h2 = vs.FSActLayer()
vs.ClipSurface(h1, h2)
h3 = vs.PrevObj(h2)
if h3 != h1:
vs.SetFPat(h3, 5)
ClipSurfaceExample()
</code>
</code>
</sample>
</sample>

Revision as of 14:28, 13 August 2013

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

Description

Creates a new surface object by subtracting the intersection of surfaces s1 and s2 from s1.

PROCEDURE ClipSurface(
s1 :HANDLE;
s2 :HANDLE);
def vs.ClipSurface(s1, s2):
    return None

Parameters

s1 HANDLE Handle to object.
s2 HANDLE Handle to object.

Remarks

google.com

ClipSurface is not reliable if the smaller poly is not fully contained within the larger one.


Note that in the above example, PrevObj(h2); was used to get a handle to the clipped surface. Also note that checking the validity of this handle and possibly even its object type (polyline) or comparing it to the object being clipped (IF h3 <> h1), is necessary to check that the clipping operation was successful.

Example

VectorScript

PROCEDURE ClipSurfaceExample;
VAR
h1, h2, h3 :HANDLE;
BEGIN
DSelectAll;
CallTool(-203);
h1 := FSActLayer;
DSelectAll;
CallTool(-203);
h2 := FSActLayer;
ClipSurface(h1, h2);
h3 := PrevObj(h2);
IF h3 <> h1 THEN SetFPat(h3, 5);
END;
RUN(ClipSurfaceExample);

Python

def ClipSurfaceExample():
	vs.DSelectAll()
	vs.CallTool(-203)
	h1 = vs.FSActLayer()
	vs.DSelectAll()
	vs.CallTool(-203)
	h2 = vs.FSActLayer()
	vs.ClipSurface(h1, h2)
	h3 = vs.PrevObj(h2)
	if h3 != h1:
		vs.SetFPat(h3, 5)
ClipSurfaceExample()

Version

Availability: from VectorWorks8.5