Difference between revisions of "VS:CreateLoftSurfaces"

From Vectorworks Developer
Jump to: navigation, search
m (1 revision)
 
(fix and simplify example, which was giving errors)
(One intermediate revision by one user not shown)
Line 50: Line 50:
 
<code lang="pas">
 
<code lang="pas">
 
PROCEDURE Example;
 
PROCEDURE Example;
CONST
 
PLENGTH = 10;
 
PHEIGHT = 20;
 
POFFSET = 5;
 
pWidth = 3;
 
 
VAR
 
VAR
h, groupHand :HANDLE;
+
h, grH : HANDLE;
bRule, bClose, bSolid :BOOLEAN;
+
x, y, z, offset : REAL;
 +
bRule, bClose, bSolid : BOOLEAN;
 +
 
BEGIN
 
BEGIN
BeginGroup;
+
x := 10m;
 +
y := 20m;
 +
z := 3m;
 +
offset := 5m;
 +
 +
BeginGroupN(grH);
 +
h := CreateNurbsCurve(-x/2, 0, 0, true, 1);
 +
AddVertex3D(h, -x/2, y, 0);
 +
AddVertex3D(h, x/2, y, 0);
 +
AddVertex3D(h, x/2, 0, 0);
  
h := CreateNurbsCurve(-PLENGTH/2, 0, 0, true, 1);
+
h := CreateNurbsCurve(-x/2 -offset, 0, z, true, 1);
AddVertex3D(h, -PLENGTH/2,PHEIGHT,0);
+
AddVertex3D(h, -x/2 -offset, y +offset, z);
AddVertex3D(h, PLENGTH/2,PHEIGHT,0);
+
AddVertex3D(h, x/2 +offset, y +offset, z);
AddVertex3D(h, PLENGTH/2,0,0);
+
AddVertex3D(h, x/2 +offset, 0, z);
 
+
EndGroup;
h := CreateNurbsCurve(-PLENGTH/2-POFFSET,0,pWidth, true, 1);
+
AddVertex3D(h, -PLENGTH/2-POFFSET, PHEIGHT+POFFSET, pWidth);
+
bRule := TRUE;
AddVertex3D(h, PLENGTH/2+POFFSET, PHEIGHT+POFFSET, pWidth);
+
bClose := FALSE;
AddVertex3D(h, PLENGTH/2+POFFSET, 0, pWidth);
+
bSolid := FALSE;
 
+
EndGroup;
+
grH := CreateLoftSurfaces(grH, bRule, bClose, bSolid);
groupHand := LNewObj;
+
bRule := TRUE;
+
bClose := FALSE;
+
bSolid := FALSE;
+
groupHand := CreateLoftSurfaces(groupHand, bRule, bClose, bSolid);
+
SetRot3D(LNewObj,#90d,#0d,#0d,0,0,0);
+
 
END;
 
END;
 
RUN(Example);
 
RUN(Example);
Line 109: Line 109:
 
-----------------------------------------------------------------------------------------------------------
 
-----------------------------------------------------------------------------------------------------------
 
<version>
 
<version>
Availability: from VectorWorks10.0
+
Availability: from VectorWorks 10.0
  
 
</version>
 
</version>

Revision as of 00:44, 16 June 2019

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


Description

Creates NURBS surfaces by interpolating a group of cross-section curves. The nurbs curves are lofted in the order in which they were added to the group.
FUNCTION CreateLoftSurfaces(
groupCurvesHd  :HANDLE;
bRule  :BOOLEAN;
bClose  :BOOLEAN;
bSolid  :BOOLEAN) : HANDLE;
def vs.CreateLoftSurfaces(groupCurvesHd, bRule, bClose, bSolid):
    return HANDLE

Parameters

groupCurvesHd HANDLE
bRule BOOLEAN
bClose BOOLEAN
bSolid BOOLEAN

Example

VectorScript

PROCEDURE Example;
VAR
	h, grH : HANDLE;
	x, y, z, offset : REAL;
	bRule, bClose, bSolid : BOOLEAN;
	
BEGIN
	x := 10m;
	y := 20m;
	z := 3m;
	offset := 5m;
	
	BeginGroupN(grH);
		h := CreateNurbsCurve(-x/2, 0, 0, TRUE, 1);
		AddVertex3D(h, -x/2, y, 0);
		AddVertex3D(h, x/2, y, 0);
		AddVertex3D(h, x/2, 0, 0);

		h := CreateNurbsCurve(-x/2 -offset, 0, z, TRUE, 1);
		AddVertex3D(h, -x/2 -offset, y +offset, z);
		AddVertex3D(h, x/2 +offset, y +offset, z);
		AddVertex3D(h, x/2 +offset, 0, z);
	EndGroup;
	
	bRule := TRUE;
	bClose := FALSE;
	bSolid := FALSE;
	
	grH := CreateLoftSurfaces(grH, bRule, bClose, bSolid);
END;
RUN(Example);

Python

def Example():
	PLENGTH = 10
	PHEIGHT = 20
	POFFSET = 5
	pWidth = 3

	vs.BeginGroup()
	
	h = vs.CreateNurbsCurve(-PLENGTH/2, 0, 0, True, 1)
	vs.AddVertex3D(h, -PLENGTH/2,PHEIGHT,0)
	vs.AddVertex3D(h, PLENGTH/2,PHEIGHT,0)
	vs.AddVertex3D(h, PLENGTH/2,0,0)

	h = vs.CreateNurbsCurve(-PLENGTH/2-POFFSET,0,pWidth, True, 1)
	vs.AddVertex3D(h, -PLENGTH/2-POFFSET, PHEIGHT+POFFSET, pWidth)
	vs.AddVertex3D(h, PLENGTH/2+POFFSET, PHEIGHT+POFFSET, pWidth);
	vs.AddVertex3D(h, PLENGTH/2+POFFSET, 0, pWidth);

	vs.EndGroup()
	
Example()

Version

Availability: from VectorWorks 10.0
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox