Template:AddSurface: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
No edit summary
No edit summary
Line 17: Line 17:
==== Python ====
==== Python ====
<code lang="py">
<code lang="py">
# this will not be called prior Vectorworks 2022 SP3
# as the calback functions will not be executed prior to that version
def Example():
def Example():
vs.DSelectAll()
vs.DSelectAll()
vs.CallTool(-203)
 
h1 = vs.FSActLayer()
def reultCallback1():
vs.DSelectAll()
h1 = vs.FSActLayer()
vs.CallTool(-203)
vs.DSelectAll()
h2 = vs.FSActLayer()
h3 = vs.AddSurface(h1, h2)
def reultCallback2():
if h3 != None :   
h2 = vs.FSActLayer()
vs.SetFPat(h3, 5)
h3 = vs.AddSurface(h1, h2)
if h3 != None :   
vs.SetFPat(h3, 5)
vs.CallTool(-203, reultCallback2)
vs.CallTool(-203, reultCallback1)
 
Example()
Example()
</code>
</code>

Revision as of 22:02, 20 January 2022

VectorScript

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

Python

# this will not be called prior Vectorworks 2022 SP3
# as the calback functions will not be executed prior to that version
def Example():
	vs.DSelectAll()

	def reultCallback1():
		h1 = vs.FSActLayer()
		vs.DSelectAll()
		
		def reultCallback2():
			h2 = vs.FSActLayer()
			h3 = vs.AddSurface(h1, h2)
			if h3 != None :  
				vs.SetFPat(h3, 5)
		
		
		vs.CallTool(-203, reultCallback2)
			
	vs.CallTool(-203, reultCallback1)

Example()