Logo syde

3DPolyline

A 3DPolyline represents a sequence of straight lines in three-dimensional space. It is used to create complex wireframe shapes and 3D paths.

Table of Contents

Methods

NameSignature
AppendVertexpolyline.AppendVertex(Point)
Copypolyline.Copy()
Deletepolyline.Delete()
Explodepolyline.Explode()
GetBoundingBoxpolyline.GetBoundingBox()
Highlightpolyline.Highlight(Flag)
IntersectWithpolyline.IntersectWith(Entity, ExtendArg)
Mirrorpolyline.Mirror(Point1, Point2)
Mirror3Dpolyline.Mirror3D(Point1, Point2, Point3)
Movepolyline.Move(FromPoint, ToPoint)
Rotatepolyline.Rotate(BasePoint, RotationAngle)
Rotate3Dpolyline.Rotate3D(Point1, Point2, RotationAngle)
ScaleEntitypolyline.ScaleEntity(BasePoint, ScaleFactor)
TransformBypolyline.TransformBy(TransformationMatrix)
Updatepolyline.Update()

AppendVertex

Signature
javascript

polyline.AppendVertex(Point)

Description

Adds a new vertex to the end of the 3D polyline. The Point parameter must be an object that represents the 3D coordinates of the new vertex.

Parameters
  • Point: A 3D point with coordinates (X, Y, Z).
Return
  • No return value.
Example
javascript

// Add a vertex to the end of the polyline

polyline.AppendVertex([10, 20, 30]);

Copy

Signature
javascript

polyline.Copy()

Description

Creates an independent copy of the current 3D polyline.

Parameters
  • None
Return
  • A new 3DPolyline object.
Example
javascript

// Create a copy of the polyline

var newPolyline = polyline.Copy();

Delete

Signature
javascript

polyline.Delete()

Description

Deletes the 3D polyline from the drawing.

Parameters
  • None
Return
  • No return value.
Example
javascript

// Delete the polyline

polyline.Delete();

Properties {#properties}

NomeFirma
AppendVertexpolyline.AppendVertex(Point)
Copypolyline.Copy()
Deletepolyline.Delete()
Explodepolyline.Explode()
GetBoundingBoxpolyline.GetBoundingBox()
Highlightpolyline.Highlight(Flag)
IntersectWithpolyline.IntersectWith(Entity, ExtendArg)
Mirrorpolyline.Mirror(Point1, Point2)
Mirror3Dpolyline.Mirror3D(Point1, Point2, Point3)
Movepolyline.Move(FromPoint, ToPoint)
Rotatepolyline.Rotate(BasePoint, RotationAngle)
Rotate3Dpolyline.Rotate3D(Point1, Point2, RotationAngle)
ScaleEntitypolyline.ScaleEntity(BasePoint, ScaleFactor)
TransformBypolyline.TransformBy(TransformationMatrix)
Updatepolyline.Update()

Closed

Description

Determines whether the 3D polyline forms a closed path. When set to true, a segment connecting the last point to the first point is automatically added.

Type
  • Boolean
Example
javascript

// Check if the polyline is closed

var isClosed = polyline.Closed;

// Close the polyline

polyline.Closed = true;

Coordinates

Description

Provides access to the complete array of coordinates that define the 3D polyline.

Type
  • Array of Point3d
Example
javascript

// Get all coordinates

var coords = polyline.Coordinates;

// Print the coordinates

for (var i = 0; i < coords.length; i++) {

console.log("Point " + i + ": (" + coords[i].X + ", " + coords[i].Y + ", " + coords[i].Z + ")");

}

Events {#events}

NameDescription
ModifiedFired when the 3D polyline is modified.

Modified

Description

This event is triggered when the 3D polyline is modified in any way, including adding or removing vertices, or changing its properties.

Event Handler Syntax
javascript

function onModified(sender, args) {

// Code to execute when the polyline is modified

}

polyline.Modified.add(onModified);

Usage Examples {#usage-examples}

Creating a 3D Polyline

javascript

// Create a new 3D polyline

var points = [

[0, 0, 0],

[10, 10, 0],

[20, 0, 10],

[30, 10, 20]

];

var polyline = object.Add3Dpoly(points);

Modifying Vertices

javascript

// Add a new vertex

polyline.AppendVertex([40, 0, 30]);

// Get the coordinates

var coords = polyline.Coordinates;

console.log("Number of vertices: " + coords.length);

// Close the polyline

polyline.Closed = true;

Transformations

javascript

// Rotate the polyline around the Z axis

var basePoint = [0, 0, 0];

var rotationAngle = 45; // degrees

polyline.Rotate(basePoint, rotationAngle);

// Move the polyline

var fromPoint = [0, 0, 0];

var toPoint = [10, 10, 10];

polyline.Move(fromPoint, toPoint);