Skip to content

◷ 发表于: 2025-03-18

◷ 更新于: 2025-08-01

🅆 字数: 0

选中指定的原子序号

最终效果: selectAtom

typescript
/**
 * @function 选中所指定的原子序号
 */
function atomSelectionOfIndex(index: ElementIndex) {
  const atom = StructureSelectionQuery(
    "Atom",
    MolScriptBuilder.struct.modifier.union([
      MolScriptBuilder.struct.generator.atomGroups({
        "atom-test": MolScriptBuilder.core.rel.eq([
          MolScriptBuilder.acp("sourceIndex"),
          index,
        ]),
      }),
    ]),
    { category: StructureSelectionCategory.Atom }
  );
  plugin.managers.structure.selection.fromSelectionQuery("add", atom);
}

基于 CC BY-NC-SA 4.0 许可发布