Difference between revisions of "VS:CreateLoftSurfaces"

From Vectorworks Developer
Jump to: navigation, search
(fix and simplify example, which was giving errors)
(The python example was missing the actual lofting command.)
 
Line 84: Line 84:
 
<code lang="py">
 
<code lang="py">
 
def Example():
 
def Example():
PLENGTH = 10
+
x = 10
PHEIGHT = 20
+
y = 20
POFFSET = 5
+
z = 3
pWidth = 3
+
offset = 5
  
vs.BeginGroup()
+
grH = vs.BeginGroupN(None)
 
 
h = vs.CreateNurbsCurve(-PLENGTH/2, 0, 0, True, 1)
+
h = vs.CreateNurbsCurve(-x/2, 0, 0, True, 1)
vs.AddVertex3D(h, -PLENGTH/2,PHEIGHT,0)
+
vs.AddVertex3D(h, -x/2,y,0)
vs.AddVertex3D(h, PLENGTH/2,PHEIGHT,0)
+
vs.AddVertex3D(h, x/2,y,0)
vs.AddVertex3D(h, PLENGTH/2,0,0)
+
vs.AddVertex3D(h, x/2,0,0)
  
h = vs.CreateNurbsCurve(-PLENGTH/2-POFFSET,0,pWidth, True, 1)
+
h = vs.CreateNurbsCurve(-x/2-offset,0,z, True, 1)
vs.AddVertex3D(h, -PLENGTH/2-POFFSET, PHEIGHT+POFFSET, pWidth)
+
vs.AddVertex3D(h, -x/2-offset, y+offset, z)
vs.AddVertex3D(h, PLENGTH/2+POFFSET, PHEIGHT+POFFSET, pWidth);
+
vs.AddVertex3D(h, x/2+offset, y+offset, z);
vs.AddVertex3D(h, PLENGTH/2+POFFSET, 0, pWidth);
+
vs.AddVertex3D(h, x/2+offset, 0, z);
  
 
vs.EndGroup()
 
vs.EndGroup()
 +
 +
bRule = True
 +
bClose = False
 +
bSolid = False
 +
 +
grH = vs.CreateLoftSurfaces(grH, bRule, bClose, bSolid)
 
 
 
Example()
 
Example()

Latest revision as of 07:48, 17 June 2020

.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():
	x = 10
	y = 20
	z = 3
	offset = 5

	grH = vs.BeginGroupN(None)
	
	h = vs.CreateNurbsCurve(-x/2, 0, 0, True, 1)
	vs.AddVertex3D(h, -x/2,y,0)
	vs.AddVertex3D(h, x/2,y,0)
	vs.AddVertex3D(h, x/2,0,0)

	h = vs.CreateNurbsCurve(-x/2-offset,0,z, True, 1)
	vs.AddVertex3D(h, -x/2-offset, y+offset, z)
	vs.AddVertex3D(h, x/2+offset, y+offset, z);
	vs.AddVertex3D(h, x/2+offset, 0, z);

	vs.EndGroup()
	
	bRule = True
	bClose = False
	bSolid = False
	
	grH = vs.CreateLoftSurfaces(grH, bRule, bClose, bSolid)
	
Example()

Version

Availability: from VectorWorks 10.0
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox