SView Help Center
English (US)

Clear

Author: sviewngts Last Updated: 2026-10-29 18:33

Interface List

Interface Name Description
Clear Annotations Clear annotations
Clear Measurements Clear measurements
Clear Sections Clear sections

   The same command is used for clearing; only the parameters passed differ. When the clear command is executed, a confirmation dialog pops up, and the data is cleared only after you click Confirm.

   When clearing sectioning, the section is simply hidden. When clearing annotations and measurements, the system checks whether they are associated with a view: if so, they are hidden; otherwise, they are deleted directly.

Clearing Annotations

   Execute the clear annotations command directly.

executeCommand('clearAnnotates');

   Clear annotations without a confirmation dialog.

let annotations = shapes.getShapes(M3D.Shapes.ShapeType.ANNOTATION_NOTE);
for (let annotation of annotations) {
   if (M3D.Shapes.ShapeHelper.isCorrelationModelView(annotation, scene)) {
       annotation.setVisible(false);
   } else {
       shapes.removeShape(annotation.getId());
   }
}
let paintBrushs = shapes.getShapes(M3D.Shapes.ShapeType.THREED_GESTURE_NOTE);
for (let paintBrush of paintBrushs) {
   if (M3D.Shapes.ShapeHelper.isCorrelationModelView(paintBrush, scene)) {
       paintBrush.setVisible(false);
   } else {
       shapes.removeShape(paintBrush.getId());
   }
}
let modelBoards = shapes.getShapes(M3D.Shapes.ShapeType.MODELBOARD);
for (let modelBoard of modelBoards) {
   if (M3D.Shapes.ShapeHelper.isCorrelationModelView(modelBoard, scene)) {
       modelBoard.setVisible(false);
   } else {
       shapes.removeShape(modelBoard.getId());
   }
}

Clearing Measurements

   Execute the clear measurements command directly.

executeCommand('clearMeasurements');

   Clear measurements without a confirmation dialog.

let measures = shapes.getShapes(M3D.Shapes.ShapeType.MEASURE_BASE);
for (let measure of measures) {
   if (M3D.Shapes.ShapeHelper.isCorrelationModelView(measure, scene)) {
       measure.setVisible(false);
   } else {
       shapes.removeShape(measure.getId());
   }
}

Clearing Sections

   Execute the clear sectioning command directly.

executeCommand('clearSectionPlanes');

   Clear sectioning without a confirmation dialog.

let sections = shapes.getShapes(M3D.Shapes.ShapeType.SECTION);
for (let iter = 0; iter < sections.length; iter++) {
   let section = sections[iter];
   section.enablePlanes(false);
   //可能为包围盒刨切
   section.enableSectionBox(false);
}
let sectionPlanes = shapes.getShapes(M3D.Shapes.ShapeType.SECTION_PLANE);
for (let i = 0; i < sectionPlanes.length; i++) {
   let sectionPlane = sectionPlanes[i];
   sectionPlane.setEnable(false);
}