Creates a new spline entity from control points.
This constructor creates a spline using the specified control points, knots, and optional weights. The control points must be in World Coordinate System (WCS) coordinates.
Array of control points in WCS coordinates
Array of knot values that define the spline's parameterization
Optionalweights: number[]Optional array of weights for each control point (default: 1 for all)
Optionaldegree: numberOptional degree of the spline (default: 3)
Optionalclosed: booleanWhether the spline should be closed (default: false)
Creates a new spline entity from fit points.
This constructor creates a spline that passes through the specified fit points. The fit points must be in World Coordinate System (WCS) coordinates.
Array of fit points in WCS coordinates
Knot parameterization type that defines how knots are generated
Optionaldegree: numberOptional degree of the spline (default: 3)
Optionalclosed: booleanWhether the spline should be closed (default: false)
The area enclosed by this curve. Returns 0 when the curve does not form a
closed region.
Gets the attributes object for this AcDbObject.
The AcCmObject instance containing all attributes
Gets whether this spline is closed.
A closed spline forms a complete loop where the end point connects to the start point.
True if the spline is closed, false otherwise
Sets whether this spline is closed.
True to close the spline, false to open it
Gets the database in which this object is resident.
When an object isn't added to a database, this property returns the current working database. After it is added to a database, it will be set automatically. You should never set this value manually.
The database this object belongs to
Sets the database for this object.
This is typically set automatically when the object is added to a database. Manual setting should be avoided unless you know what you're doing.
The database to associate with this object
Gets the DXF entity type name written to the file.
This value is the literal DXF record type emitted for the entity during
DXF export, such as LINE, INSERT, or DIMENSION.
Every concrete entity class must explicitly define this property so the DXF export contract stays local to the entity implementation rather than being inferred by the base class.
The DXF entity type name used during export
Gets the objectId of the extension dictionary owned by this object.
If the object does not have an extension dictionary, this returns undefined.
In ObjectARX terms, this is equivalent to AcDbObject::extensionDictionary().
The extension dictionary objectId, or undefined
Sets the objectId of the extension dictionary owned by this object.
This does not create or delete the dictionary object itself — it only establishes or clears the ownership relationship.
Passing undefined removes the association.
The extension dictionary objectId, or undefined
Returns true if this object is temporary and not yet committed to the database.
A temporary object is identified by its objectId starting with the TEMP prefix.
Gets the name of the layer referenced by this entity.
The layer name
Sets the name of the layer for this entity.
The new layer name
Gets the line style for this entity.
This method returns the line style based on the entity's linetype and other properties.
The line style object
Gets the name of the line type referenced by this entity.
The linetype name
Sets the name of the line type for this entity.
The new linetype name
Gets the line type scale factor of this entity.
When an entity is first instantiated, its line type scale is initialized to an invalid value. When the entity is added to the database, if a linetype scale has not been specified for the entity, it is set to the database's current line type scale value.
The linetype scale factor
Sets the line type scale factor for this entity.
The new linetype scale factor
Gets the line weight used by this entity.
The line weight value
Sets the line weight for this entity.
The new line weight value
Gets the object ID.
AutoCAD uses 64-bit integers to represent handles, which exceed the maximum integer value of JavaScript. Therefore, strings are used to represent object handles.
The object ID as a string
Sets the object ID.
The new object ID
Gets the object ID of the owner of this object.
The owner object ID
Sets the object ID of the owner of this object.
The new owner object ID
Returns the full property definition for this entity, including all property groups and runtime accessors.
This getter is used by the property inspector UI to:
The returned structure contains:
Note: The groups array contains AcDbEntityPropertyGroup objects whose
properties entries are runtime-resolved property descriptors that include
AcDbPropertyAccessor objects. Each property object therefore
conforms to AcDbEntityRuntimeProperty.
Gets the transparency level of this entity.
The transparency value.
Sets the transparency level of this entity.
The transparency value.
Gets the type name of this entity.
This method returns the entity type by removing the "AcDb" prefix from the constructor name.
The entity type name
Gets whether this entity is visible.
True if the entity is visible, false otherwise
Sets whether this entity is visible.
True to make the entity visible, false to hide it
ProtectedassignAssociates this object with a database. Subclasses may override database
and call this helper to avoid super setter restrictions.
Creates the extension dictionary for this object if it does not already exist.
This method closely mirrors the behavior of
AcDbObject::createExtensionDictionary() in ObjectARX.
The objectId of the extension dictionary
Writes DXF fields for this object.
DXF output writer.
The instance (for chaining).
Gets the value of the specified attribute.
This method will throw an exception if the specified attribute doesn't exist. Use getAttrWithoutException() if you want to handle missing attributes gracefully.
The name of the attribute to retrieve
The value of the specified attribute
Gets the value of the specified attribute without throwing an exception.
This method returns undefined if the specified attribute doesn't exist, making it safer for optional attributes.
The name of the attribute to retrieve
The value of the specified attribute, or undefined if it doesn't exist
ProtectedgetProtectedgetCreates the "General" property group for this entity.
This group contains common metadata attributes shared by all CAD entities (e.g., handle, layer). Each property includes a runtime AcDbPropertyAccessor allowing the property inspector to read and update live values.
Subclasses may override this method to append additional general-purpose properties while still preserving this base set.
A fully resolved property group containing runtime-accessible properties.
ProtectedgetCreates offset curves at the given signed distance, similar to ObjectARX
AcDbCurve::getOffsetCurves.
The sign of offsetDist determines the offset side relative to the curve
direction in the curve plane. Returns an empty array when offsetting fails.
Signed offset distance in drawing units
Offset curve entities (equivalent to AcDbVoidPtrArray)
Determines which side of this curve a point lies on for offset operations.
1 for the positive offset side, -1 for the negative side
Retrieves the XData associated with this object for a given application ID.
Extended Entity Data (XData) allows applications to attach arbitrary, application-specific data to an AcDbObject. Each XData entry is identified by a registered application name (AppId) and stored as an AcDbResultBuffer.
This method is conceptually equivalent to AcDbObject::xData() in ObjectARX,
but simplified to return the entire result buffer for the specified AppId.
The application ID (registered AppId name) that owns the XData
The AcDbResultBuffer associated with the AppId, or undefined
if no XData exists for that AppId
ProtectedhasProtectedhasProtectedhasRebuilds the spline geometry with new parameters.
This method recreates the underlying geometric spline object with the specified parameters. It supports the same parameter combinations as the constructor.
Array of control points in WCS coordinates
Array of knot values that define the spline's parameterization
Optionalweights: number[]Optional array of weights for each control point (default: 1 for all)
Optionaldegree: numberOptional degree of the spline (default: 3)
Optionalclosed: booleanWhether the spline should be closed (default: false)
Rebuilds the spline geometry with new parameters.
This method recreates the underlying geometric spline object with the specified parameters. It supports the same parameter combinations as the constructor.
Array of fit points in WCS coordinates
Knot parameterization type that defines how knots are generated
Optionaldegree: numberOptional degree of the spline (default: 3)
Optionalclosed: booleanWhether the spline should be closed (default: false)
Removes the XData associated with the specified application ID.
After removal, calls to getXData() for the same AppId will return undefined.
If no XData exists for the given AppId, this method has no effect.
This mirrors the behavior of clearing XData for a specific application in ObjectARX rather than removing all XData from the object.
The application ID whose XData should be removed
Resolves the effective properties of this entity.
This method determines the final, usable values for entity properties such as layer, linetype, lineweight, color, and other display-related attributes. If a property is not explicitly set on the entity (for example, it is undefined or specified as ByLayer / ByBlock), the value is resolved according to the current AutoCAD system variables and drawing context.
Typical system variables involved in the resolution process include, but are not limited to:
CLAYER – Current layerCELTYPE – Current linetypeCELWEIGHT – Current lineweightCECOLOR – Current colorThe resolution follows AutoCAD semantics:
This method does not change user-defined property settings; it only computes and applies the final effective values used for display, selection, and downstream processing.
ProtectedresolveSets the value of an attribute.
The name of the attribute to set
Optionalval: AcDbObjectAttrs[A]The value to assign to the attribute
ProtectedsetAttaches or replaces XData for this object.
If XData already exists for the given AppId, it is replaced by the provided AcDbResultBuffer. The caller is responsible for ensuring that:
This method is conceptually similar to AcDbObject::setXData() in ObjectARX.
The result buffer containing the XData to attach
ProtectedshouldGets the grip points for this spline.
Grip points are the B-spline control vertices (CVs).
Array of grip points at each control vertex
Gets the object snap points for this spline.
Object snap points are precise points that can be used for positioning when drawing or editing. This method provides snap points based on the specified snap mode.
The object snap mode
The last point
Array to populate with snap points
Draws this spline using the specified renderer.
This method renders the spline as a series of connected line segments using the spline's current style properties.
The renderer to use for drawing
The rendered spline entity, or undefined if drawing failed
Transforms this spline by the specified matrix.
Called by cad application when it wants the entity to draw itself in WCS (World Coordinate System) and acts as a wrapper / dispatcher around subWorldDraw(). The children class should never overidde this method.
It executes the following logic:
The renderer to use for drawing
Optionaldelay: booleanThe flag to delay creating one rendered entity and just create one dummy entity. Renderer can delay heavy calculation operation to avoid blocking UI when this flag is true. For now, text and mtext entity supports this flag only. Other types of entities just ignore this flag.
The rendered entity, or undefined if drawing failed
StaticfromCreates a spline entity from control points, knots, and optional weights.
Unlike the constructor, this factory tolerates imperfect DWG/DXF data: it derives
a valid degree when declaredDegree is missing or zero, clamps degree to the
available control points, and returns null instead of throwing when the input
cannot produce a valid NURBS curve.
Control vertices in World Coordinate System (WCS) coordinates
Full knot vector for the spline
Optional per-control-point weights; ignored when the array length
does not match controlPoints.length
Degree from the source file; when less than 1, derived from
knots.length - controlPoints.length - 1, then clamped to [1, controlPoints.length - 1]
Whether the spline forms a closed loop
A new spline entity, or null if construction fails
StaticfromCreates a spline entity from parsed DWG/DXF SPLINE fields.
This is the preferred entry point for file converters. Control-point data is tried first; when that fails (for example, too few control points for the knot vector), fit-point data is used as a fallback.
The flag field encodes spline properties from group code 70:
0x01): closed spline0x02): periodic0x04): rational (weights are passed separately via weights)1024): Chord knot parameterization for fit splines2048): SqrtChord knot parameterization for fit splinesParsed SPLINE entity payload from a DWG/DXF reader
Control vertices (group codes 10/20/30)
Optionaldegree?: numberDeclared degree (group code 71)
OptionalendTangent?: null | AcGeVector3dLikeOptional end tangent (group codes 13/23/33)
Fit points (group codes 11/21/31)
SPLINE flags (group code 70)
Knot values (group code 40)
Count of control points (group code 73)
Count of fit points (group code 74)
Count of knots (group code 72)
OptionalstartTangent?: null | AcGeVector3dLikeOptional start tangent (group codes 12/22/32)
Optionalweights?: number[]Optional weights (group code 41)
A new spline entity, or null when neither control nor fit data can be used
StaticfromCreates a spline entity that interpolates fit points.
Knots and control points are computed internally from the fit data. Start and end
tangents are applied only when they are non-zero direction vectors. Degree is
clamped so that fitPoints.length + tangentCount >= degree + 1.
Points the spline should pass through, in WCS coordinates
Knot parameterization ('Uniform', 'Chord', or 'SqrtChord')
Requested degree from the source file; defaults to 3 when missing or less than 1, then clamped to fit the available fit/tangent data
Whether the spline forms a closed loop
OptionalstartTangent: null | AcGeVector3dLikeOptional start tangent direction; ignored when zero-length
OptionalendTangent: null | AcGeVector3dLikeOptional end tangent direction; ignored when zero-length
A new spline entity, or null if construction fails
Represents a spline entity in AutoCAD.
A spline is a 3D geometric object defined by control points or fit points. Splines are smooth curves that can be used to create complex curved shapes in drawings. They can be either open or closed curves.
Example