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
Name | Signature |
---|---|
AppendVertex | polyline.AppendVertex(Point) |
Copy | polyline.Copy() |
Delete | polyline.Delete() |
Explode | polyline.Explode() |
GetBoundingBox | polyline.GetBoundingBox() |
Highlight | polyline.Highlight(Flag) |
IntersectWith | polyline.IntersectWith(Entity, ExtendArg) |
Mirror | polyline.Mirror(Point1, Point2) |
Mirror3D | polyline.Mirror3D(Point1, Point2, Point3) |
Move | polyline.Move(FromPoint, ToPoint) |
Rotate | polyline.Rotate(BasePoint, RotationAngle) |
Rotate3D | polyline.Rotate3D(Point1, Point2, RotationAngle) |
ScaleEntity | polyline.ScaleEntity(BasePoint, ScaleFactor) |
TransformBy | polyline.TransformBy(TransformationMatrix) |
Update | polyline.Update() |
AppendVertex
SignatureDescriptionjavascript
polyline.AppendVertex(Point)
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.
Point
: A 3D point with coordinates (X, Y, Z).
- No return value.
javascript
// Add a vertex to the end of the polyline
polyline.AppendVertex([10, 20, 30]);
Copy
SignatureDescriptionjavascript
polyline.Copy()
Creates an independent copy of the current 3D polyline.
Parameters- None
- A new 3DPolyline object.
javascript
// Create a copy of the polyline
var newPolyline = polyline.Copy();
Delete
SignatureDescriptionjavascript
polyline.Delete()
Deletes the 3D polyline from the drawing.
Parameters- None
- No return value.
javascript
// Delete the polyline
polyline.Delete();
Properties {#properties}
Nome | Firma |
---|---|
AppendVertex | polyline.AppendVertex(Point) |
Copy | polyline.Copy() |
Delete | polyline.Delete() |
Explode | polyline.Explode() |
GetBoundingBox | polyline.GetBoundingBox() |
Highlight | polyline.Highlight(Flag) |
IntersectWith | polyline.IntersectWith(Entity, ExtendArg) |
Mirror | polyline.Mirror(Point1, Point2) |
Mirror3D | polyline.Mirror3D(Point1, Point2, Point3) |
Move | polyline.Move(FromPoint, ToPoint) |
Rotate | polyline.Rotate(BasePoint, RotationAngle) |
Rotate3D | polyline.Rotate3D(Point1, Point2, RotationAngle) |
ScaleEntity | polyline.ScaleEntity(BasePoint, ScaleFactor) |
TransformBy | polyline.TransformBy(TransformationMatrix) |
Update | polyline.Update() |
Closed
DescriptionDetermines 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.
- Boolean
javascript
// Check if the polyline is closed
var isClosed = polyline.Closed;
// Close the polyline
polyline.Closed = true;
Coordinates
DescriptionProvides access to the complete array of coordinates that define the 3D polyline.
Type- Array of Point3d
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}
Name | Description |
---|---|
Modified | Fired when the 3D polyline is modified. |
Modified
DescriptionThis event is triggered when the 3D polyline is modified in any way, including adding or removing vertices, or changing its properties.
Event Handler Syntaxjavascript
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);