Template:AddSurface: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (fix typo) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 3: | Line 3: | ||
PROCEDURE AddSurfaceExample; | PROCEDURE AddSurfaceExample; | ||
VAR | VAR | ||
h1, h2, h3 :HANDLE; | h1, h2, h3 :HANDLE; | ||
BEGIN | BEGIN | ||
DSelectAll; | DSelectAll; | ||
CallTool(-203); | CallTool(-203); | ||
h1 := FSActLayer; | h1 := FSActLayer; | ||
DSelectAll; | DSelectAll; | ||
CallTool(-203); | CallTool(-203); | ||
h2 := FSActLayer; | h2 := FSActLayer; | ||
h3 := AddSurface(h1, h2); | h3 := AddSurface(h1, h2); | ||
IF h3 <> nil THEN SetFPat(h3, 5); | IF h3 <> nil THEN SetFPat(h3, 5); | ||
END; | END; | ||
RUN(AddSurfaceExample);</code> | RUN(AddSurfaceExample);</code> | ||
==== Python ==== | ==== Python ==== | ||
The python code will not pause for the execution of CallTool, that's why it uses a callback mechanism for the script to know when the temp tool has finished. | |||
<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() | ||
def resultCallback1(): | |||
h1 = vs.FSActLayer() | |||
vs.DSelectAll() | |||
def resultCallback2(): | |||
h2 = vs.FSActLayer() | |||
h3 = vs.AddSurface(h1, h2) | |||
if h3 != None : | |||
vs.SetFPat(h3, 5) | |||
vs.CallTool(-203, resultCallback2) | |||
vs.CallTool(-203, resultCallback1) | |||
Example() | Example() | ||
</code> | </code> |
Latest revision as of 04:13, 21 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
The python code will not pause for the execution of CallTool, that's why it uses a callback mechanism for the script to know when the temp tool has finished.
# 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 resultCallback1(): h1 = vs.FSActLayer() vs.DSelectAll() def resultCallback2(): h2 = vs.FSActLayer() h3 = vs.AddSurface(h1, h2) if h3 != None : vs.SetFPat(h3, 5) vs.CallTool(-203, resultCallback2) vs.CallTool(-203, resultCallback1) Example()