Delete GeometryInstance

add primitive by geometryInstances : Array.<GeometryInstance>,now i want delete one GeometryInstance?

@zyy1987 I’m not exactly sure what you’re asking. Could you please provide a bit more context and code showing what you are trying to do? Thanks!

I create a primitive object by:
const polylinepc = ;
const coordinates = ;
const colors = ;
entity.geometry.coordinates.forEach((i) => {
coordinates.push(S3DP.Cartesian3.fromDegrees(i[0], i[1], i[2]));

        const polyline = new S3DP.PolylineGeometry({
          positions: coordinates,
          width: polylineWidth,
          // colors: colors,

        const objId = S3DP.createGuid();
        geometry = new S3DP.GeometryInstance({
          id: objId,
          geometry: polyline,
          attributes: {
            show: new S3DP.ShowGeometryInstanceAttribute(true),
            color: S3DP.ColorGeometryInstanceAttribute.fromColor(graphicsColor),
            width: new S3DP.GeometryInstanceAttribute({
              componentDatatype: S3DP.ComponentDatatype.UNSIGNED_BYTE,
              componentsPerAttribute: 1,
              normalize: false,
              value: [polylineWidth],

new S3DP.Primitive({
geometryInstances: polylinepc,
appearance: new S3DP.PolylineColorAppearance({
flat: true,
renderState: {
depthTest: false,

In some cases,I want delete one GeometryInstance?

@zyy1987 Thanks for sharing your code! The geometryInstances property of Primitive is read-only, so you cannot hide a single instance once the Primitive is created. Just in case, here’s an example Sandcastle showing how to remove an entire Primitive that contains instances.

It’s not a perfect solution, but you can hide a single instance without deleting it - see this thread: How to hide a single geometry instance?.

Thank you for your reply。