Revision Cloud Generation
Revision Cloud Generation
Generate AutoCAD REVCLOUD-style revision clouds from path coordinates. The result is a polyline with semicircular arc bulges.
Online Example
Online Demo{target="_blank"}
Overview
A revision cloud is a common CAD markup style used to highlight areas that need changes or attention in a drawing. The algorithm divides each path segment into equal parts according to the specified arc length and assigns each subsegment a semicircular bulge value (bulge = 1) to produce a continuous scalloped outline.
Typical application scenarios:
- Drawing review markup
- Change-area marking
- Highlighting important regions
Usage
Method 1: Command Panel
In the menu bar, choose Create -> Revision Cloud, click Revision Cloud in the Ribbon Draw group, or enter the command REVCLOUD (alias RC).
Method 2: Call in Code
const { PolylineEnt, Engine, generateRevcloudBulgePoints } = vjcad;
// Define path
const path = [[0, 0], [200, 0], [200, 100], [0, 100]];
// Generate bulge points for the revision cloud
const bulgePoints = generateRevcloudBulgePoints(path, {
arcLength: 30, // Chord length of each arc segment
isClosed: true, // Closed path
});
// Create polyline entity
const cloud = new PolylineEnt(bulgePoints);
cloud.isClosed = true;
cloud.setDefaults();
Engine.addEntities(cloud);API Reference
generateRevcloudBulgePoints
function generateRevcloudBulgePoints(
pathPoints: PointInput[],
options?: RevcloudOptions
): BulgePointsGenerates cloud-style BulgePoints from a path vertex array. The result can be passed directly into new PolylineEnt(bulgePoints).
Parameters
| Parameter | Type | Description |
|---|---|---|
pathPoints | PointInput[] | Path vertex array, at least 2 points. Supports [x, y], Point2D, and other formats |
options | RevcloudOptions | Optional configuration |
RevcloudOptions
| Property | Type | Default | Description |
|---|---|---|---|
arcLength | number | 50 | Chord length of each arc segment |
bulge | number | 1 | Bulge value. 1 = semicircle, 0.5 ≈ 90° arc, negative values reverse the arc direction |
isClosed | boolean | false | Whether the path is closed. When true, the last vertex automatically connects to the first |
Return Value
BulgePoints — a bulged point collection that can be used directly to construct a PolylineEnt.
Algorithm
Input: path point array + arc length parameter
↓
For each adjacent point pair:
↓
1. Calculate distance d between the two points
↓
2. Number of arc segments n = max(1, round(d / arcLength))
↓
3. Divide the line segment into n equal parts
↓
4. Set bulge = 1 for each division point
↓
Concatenate all division points
(remove duplicate points at joints between adjacent segments)
↓
Output: BulgePoints (usable to construct PolylineEnt)Bulge and Arc Shape
The bulge value determines arc curvature:
bulge | Arc Shape | Sweep Angle |
|---|---|---|
0 | Straight line | 0° |
0.5 | Shallow arc | ≈ 90° |
1 | Semicircle | 180° |
-1 | Reverse semicircle | 180° in the opposite direction |
Tips
Revision clouds use bulge = 1 by default, which matches the visual effect of AutoCAD REVCLOUD. You can change the arc curvature by adjusting the bulge parameter.
Examples
Closed Rectangular Revision Cloud
const path = [[0, 0], [200, 0], [200, 100], [0, 100]];
const bp = generateRevcloudBulgePoints(path, {
arcLength: 20,
isClosed: true,
});
const cloud = new PolylineEnt(bp);
cloud.isClosed = true;
cloud.setDefaults();
Engine.addEntities(cloud);Open-Path Revision Cloud
const path = [[0, 0], [80, 30], [160, 0], [240, 30]];
const bp = generateRevcloudBulgePoints(path, {
arcLength: 15,
isClosed: false,
});
const cloud = new PolylineEnt(bp);
cloud.setDefaults();
Engine.addEntities(cloud);Compare Different Arc Lengths
[10, 25, 50].forEach((arcLen, i) => {
const bp = generateRevcloudBulgePoints(
[[0, i * 40], [300, i * 40]],
{ arcLength: arcLen }
);
const pline = new PolylineEnt(bp);
pline.setDefaults();
pline.color = i + 1;
Engine.addEntities(pline);
});