@floless/app 0.174.0 → 0.175.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/autostart.mjs +117 -10
  2. package/dist/floless-server.cjs +2 -2
  3. package/dist/pdf-engine/floless_pdf/__init__.py +53 -0
  4. package/dist/pdf-engine/floless_pdf/backend_pdfium.py +823 -0
  5. package/dist/pdf-engine/floless_pdf/backend_pymupdf.py +245 -0
  6. package/dist/pdf-engine/floless_pdf/geometry.py +115 -0
  7. package/dist/pdf-engine/floless_pdf/images.py +75 -0
  8. package/dist/pdf-engine/floless_pdf/pages.py +136 -0
  9. package/dist/pdf-engine/floless_pdf/textrules.py +200 -0
  10. package/dist/schemas/steel.model.v2.schema.json +45 -1
  11. package/dist/skills/floless-app-approval/SKILL.md +28 -3
  12. package/dist/skills/floless-app-knowledge/SKILL.md +3 -2
  13. package/dist/skills/floless-app-sketches/SKILL.md +71 -0
  14. package/dist/skills/floless-app-sketches/references/steel-plate.md +15 -0
  15. package/dist/skills/floless-app-steel-model/SKILL.md +14 -1
  16. package/dist/skills/floless-app-steel-model/references/elements.md +90 -23
  17. package/dist/skills/floless-app-steel-takeoff/SKILL.md +18 -7
  18. package/dist/skills/floless-app-tweak-contract/SKILL.md +3 -2
  19. package/dist/web/agents.js +1 -1
  20. package/dist/web/app.css +120 -15
  21. package/dist/web/app.js +89 -38
  22. package/dist/web/aware-hold.js +10 -0
  23. package/dist/web/aware.js +405 -51
  24. package/dist/web/boot-watchdog.js +249 -0
  25. package/dist/web/card-details.js +88 -0
  26. package/dist/web/chat.css +29 -0
  27. package/dist/web/chat.js +430 -128
  28. package/dist/web/commands-connection-design.js +23 -0
  29. package/dist/web/commands-revit.js +3 -0
  30. package/dist/web/commands-shell.js +226 -10
  31. package/dist/web/commands-steel.js +95 -5
  32. package/dist/web/commands-tekla-parser.js +21 -1
  33. package/dist/web/connection-design-editor.html +71 -0
  34. package/dist/web/connection-design-editor.js +794 -61
  35. package/dist/web/connection-design-handles.js +9 -3
  36. package/dist/web/element-approval.js +74 -0
  37. package/dist/web/element-context.js +76 -6
  38. package/dist/web/element-geometry.js +8 -2
  39. package/dist/web/element-holds.js +68 -5
  40. package/dist/web/element-type-actions.js +22 -3
  41. package/dist/web/element-types.js +12 -5
  42. package/dist/web/element-words.js +15 -11
  43. package/dist/web/grid-place.js +51 -0
  44. package/dist/web/guide.js +2 -0
  45. package/dist/web/index.html +13 -16
  46. package/dist/web/instructor.js +5 -2
  47. package/dist/web/missed-routines.js +6 -1
  48. package/dist/web/model-change-findings.js +147 -32
  49. package/dist/web/model-change-review.js +435 -32
  50. package/dist/web/model-clash-check.css +100 -0
  51. package/dist/web/model-clash-check.js +681 -0
  52. package/dist/web/model-clip-box.js +204 -0
  53. package/dist/web/model-clip-list.js +153 -3
  54. package/dist/web/model-clip-session.js +3 -3
  55. package/dist/web/model-clip-three-overlay.js +135 -25
  56. package/dist/web/model-editor.css +2 -0
  57. package/dist/web/model-elements.js +273 -18
  58. package/dist/web/model-fit-checks.js +354 -0
  59. package/dist/web/model-spatial-panel.js +9 -3
  60. package/dist/web/model-spatial-tools.js +12 -3
  61. package/dist/web/model-tekla-selection.js +74 -0
  62. package/dist/web/model-view-query.js +70 -14
  63. package/dist/web/model-viewport-revit-adapter.js +8 -7
  64. package/dist/web/model-viewport-toolbar.js +8 -4
  65. package/dist/web/pages.js +78 -1
  66. package/dist/web/project-history.js +31 -1
  67. package/dist/web/revit-editor.css +34 -1
  68. package/dist/web/revit-editor.js +176 -55
  69. package/dist/web/run-history.js +8 -0
  70. package/dist/web/sketch-editor.js +141 -2
  71. package/dist/web/sketches.js +192 -6
  72. package/dist/web/start-place.js +46 -0
  73. package/dist/web/steel-3d-core.js +70 -0
  74. package/dist/web/steel-3d-view.js +288 -47
  75. package/dist/web/steel-change-review.css +29 -0
  76. package/dist/web/steel-custom-connection.js +6 -0
  77. package/dist/web/steel-editor.html +532 -33
  78. package/dist/web/steel-filter.html +8 -3
  79. package/dist/web/steel-model-checks.css +76 -0
  80. package/dist/web/steel-model-commands.js +1 -1
  81. package/dist/web/steel-model-v2-commands.js +17 -0
  82. package/dist/web/steel-view-generation.js +6 -2
  83. package/dist/web/teams.js +259 -19
  84. package/dist/web/tekla-editor.html +1 -0
  85. package/dist/web/terminal-requests.js +6 -0
  86. package/dist/web/vendor/connection-engine.js +890 -89
  87. package/dist/web/workspaces.js +630 -48
  88. package/package.json +4 -1
  89. package/preferences-file.mjs +27 -0
@@ -31,9 +31,9 @@ import { createModelPanelBridge, createModelSelectionOriginGuard, createPanelHos
31
31
  import { mountModelDisplayUnits } from './model-display-units.js';
32
32
  import { formatModelProperty, teklaObjectFields, teklaObjectLabel, teklaPropertyGroups, teklaTypeGroups } from './model-property-display.js';
33
33
  import { formatLength, parseLengthMm } from './display-units.js';
34
- import { TEKLA_GEOMETRY_SELECTION_CAP, changeTeklaSelectionScope, readTeklaSelectionScopes, teklaAssemblyMembership, teklaGeometrySelection, teklaHierarchyIndexes } from './model-tekla-selection.js';
34
+ import { TEKLA_GEOMETRY_SELECTION_CAP, changeTeklaSelectionScope, isTeklaQueryable, isTeklaUndrawn, readTeklaSelectionScopes, teklaAssemblyMembership, teklaDrawnState, teklaGeometrySelection, teklaHierarchyIndexes, teklaUndrawnSelection, teklaUndrawnWords } from './model-tekla-selection.js';
35
35
  import { createModelGroupNavigator } from './model-group-navigator.js';
36
- import { displayNeedsSelection, dominantColour, evaluateModelViewQuery, modelViewCandidate, parseModelViewCommand } from './model-view-query.js';
36
+ import { displayNeedsSelection, dominantColour, evaluateModelViewQuery, modelViewCandidate, parseModelViewCommand, undrawnGate } from './model-view-query.js';
37
37
  import { modelSubjectLabel, renderChatQuestions, subjectLabelText, subjectsKeyOf } from './model-chat-questions.js';
38
38
  import { PROPERTY_DIRECTORY_NAME, isPropertyPageName, propertyLabelRows, validatePropertyDirectory } from './model-property-directory.js';
39
39
  import { PAGED_PROPERTIES_COPY, createPagedPropertyReader } from './model-paged-properties.js';
@@ -333,6 +333,9 @@ const TEKLA_AUDIT_COPY = Object.freeze({
333
333
  'bolt-catalogue-missing': Object.freeze({ group: 'not-shown', title: 'Bolt not drawn', detail: 'This bolt needs a catalogue file that was missing (screwdb.db or assdb.db), so it is not drawn. Read the model again with the file to see it.' }),
334
334
  // #3552: drawn, but the bolt catalogue gives no head size, so FloLess assumed one (see boltHeadCopy).
335
335
  'bolt-head-size-assumed': Object.freeze({ group: 'shape-not-evaluated', title: 'Bolt head size assumed', detail: 'This bolt group’s entry in Tekla’s bolt catalogue (screwdb.db) has no head size, so FloLess assumed one. The bolts’ position, length and the parts they join come from the model.' }),
336
+ // #3958: drawn, but the Tekla format records no plane cut's side and FloLess's reading of it is not checked against Tekla.
337
+ 'plane-cut-side-assumed': Object.freeze({ group: 'shape-not-evaluated', title: 'Plane cut side assumed', detail: 'The Tekla version this model was saved in doesn’t record which side of a plane cut is removed. FloLess draws each plane cut on this part removing the side its cut plane faces, which is what Tekla does in models saved in Tekla Structures 20.0 and 2019, but couldn’t check that against Tekla. So no volume is shown for this part. Check its cuts in Tekla before you rely on its shape.' }),
338
+ 'cut-sliver-uncleaned': Object.freeze({ group: 'shape-not-evaluated', title: 'Cut left a sliver', detail: 'Every cut on this part was applied, and the part is drawn as computed. But one cut left a sliver where it meets the part’s own face, a face with no thickness or no area, and FloLess couldn’t clean it. So the drawn surface has a face the part doesn’t have, and no volume is shown for this part. Check that cut in Tekla before you rely on the part’s shape there.' }),
336
339
  'component-parent-unverified': Object.freeze({ group: 'hierarchy-not-confirmed', title: 'Connection hierarchy not confirmed', detail: 'This object remains in the imported model, but the parser could not verify its recorded Connection or Component parent from the available database records. The unverified hierarchy link was omitted.' }),
337
340
  'assembly-parent-unverified': Object.freeze({ group: 'hierarchy-not-confirmed', title: 'Assembly hierarchy not confirmed', detail: 'This object remains in the imported model, but the parser could not verify its recorded Assembly parent from the available database records. The unverified hierarchy link was omitted.' }),
338
341
  });
@@ -618,6 +621,26 @@ function resolveTeklaOccurrences(occurrences, { origin = 'tree', operation = 're
618
621
  return { handled: true, accepted: result.ok, reason: result.reason };
619
622
  }
620
623
 
624
+ /* -- Objects read but not drawn yet (#4008) -------------------------------------------------------------------------------
625
+ `geometrySelectionIds` stays what is lit in 3D, so an undrawn object never reaches the viewport, Fit, Isolate or Hide. The
626
+ undrawn part of a selection is derived from the rows selected, never stored. */
627
+ let teklaDrawnCache = null;
628
+ /** What this revision can answer about its undrawn objects (`teklaDrawnState`), read once per revision. */
629
+ function teklaDrawn() {
630
+ if (teklaDrawnCache?.entities !== entities || teklaDrawnCache.audit !== teklaAudit) {
631
+ teklaDrawnCache = { entities, audit: teklaAudit, state: teklaDrawnState(entities, teklaAudit?.findings) };
632
+ }
633
+ return teklaDrawnCache.state;
634
+ }
635
+
636
+ /** The undrawn objects these rows resolve to; null above the cap they share with the `drawn` ones. */
637
+ function undrawnOf(ids, drawn = 0) {
638
+ return isTeklaParser && teklaDrawn().undrawn ? teklaUndrawnSelection(ids, entityById, [teklaAssemblyMembers, teklaHierarchy.children], drawn) : [];
639
+ }
640
+
641
+ /** The undrawn objects selected now. Every path that selects refuses a selection above the cap, so this is never null. */
642
+ function undrawnSelectionIds() { return undrawnOf(selectedIds) ?? []; }
643
+
621
644
  function selectTeklaObjects(id, ids, visibleOnly = false, fit = true, origin = 'tree') {
622
645
  if (origin === 'tree' && fit && id && ids.length === 1 && teklaGroupNavigator && entityById.get(id)?.hierarchyContract === 'tekla-hierarchy/v1') {
623
646
  return resolveTeklaOccurrences([{ entityId: id, occurrencePath: [id] }], { origin }).accepted;
@@ -630,15 +653,19 @@ function selectTeklaObjects(id, ids, visibleOnly = false, fit = true, origin = '
630
653
  const gridIds = ids.filter((entityId) => entityById.get(entityId)?.structuralGrid?.mapping?.kind === 'symmetric'
631
654
  && (!visible || visible.has(entityId)));
632
655
  const geometryIds = [...new Set([...resolvedGeometryIds, ...gridIds])];
656
+ // Undrawn objects are never in the viewport, so a Type branch's "visible only" does not leave them out.
657
+ const undrawnIds = undrawnOf(ids, geometryIds.length);
658
+ if (undrawnIds === null) { toast('Selection is too large; narrow the Type list.'); return false; }
633
659
  geometrySelectionIds = geometryIds;
634
- selectedIds = geometryIds.length ? [...ids] : [];
660
+ selectedIds = geometryIds.length || undrawnIds.length ? [...ids] : [];
635
661
  if (ids.length) clipSession?.clearSelection?.();
636
662
  selectionOriginGuard.run(() => viewport.setSelection({ ids: geometryIds }));
637
663
  const selected = ids.includes(id) ? id : (ids.at(-1) ?? null);
638
664
  const result = inspect(selected, false, true, origin);
639
665
  synchronizeTeklaNavigatorSelection();
640
- if (geometryIds.length) { if (fit) facade.dispatch('model.fit-selection'); }
641
- else if (ids.length) toast(visibleOnly ? 'This type has no visible geometry to select.' : 'This object has no verified geometry to frame.');
666
+ if (geometryIds.length && fit) facade.dispatch('model.fit-selection');
667
+ if (undrawnIds.length) { if (fit) toast(`${teklaUndrawnWords(undrawnIds.length, geometryIds.length + undrawnIds.length)}.`); }
668
+ else if (!geometryIds.length && ids.length) toast(visibleOnly ? 'This type has no visible geometry to select.' : 'This object has no verified geometry to frame.');
642
669
  return result;
643
670
  }
644
671
 
@@ -653,9 +680,10 @@ function viewCandidates() {
653
680
  const candidates = [];
654
681
  for (const entity of entities) {
655
682
  if (entity?.structuralGrid?.mapping?.kind === 'symmetric') continue;
656
- // A Tekla query matches the objects that are drawn (parts, bolts): an assembly would bring in every part it holds,
657
- // whatever that part's own profile or length. Revit lists every object and reports those with nothing to draw.
658
- if (isTeklaParser && !(entity.geometry || []).length) continue;
683
+ // A Tekla query matches the objects that are drawn, or read but not drawn yet (parts, bolts): an assembly would bring
684
+ // in every part it holds, whatever that part's own profile or length. Revit lists every object and reports those with
685
+ // nothing to draw.
686
+ if (isTeklaParser && !isTeklaQueryable(entity)) continue;
659
687
  candidates.push(modelViewCandidate(entity, propertyByEntity.get(entity.id) || [], { tekla: isTeklaParser,
660
688
  label: subjectLabelOf(entity.id) || entity.id, colour: dominantColour(colours.get(entity.id) || []) }));
661
689
  }
@@ -666,7 +694,7 @@ function applyModelView(command, target, operationId = null) {
666
694
  // Every command makes an earlier paged search stale (#3539): only the latest one may apply.
667
695
  viewCommandGeneration++;
668
696
  // The viewport's public state (web/model-viewport-state.js): how many objects it shows selected.
669
- const selectedNow = () => viewport?.getState?.()?.selectionCount ?? 0;
697
+ const selectedNow = () => (viewport?.getState?.()?.selectionCount ?? 0) + undrawnSelectionIds().length;
670
698
  const base = { total: 0, matched: 0, selectionApplied: 0, selectedFinal: selectedNow(), notDrawable: 0, noField: 0, unchecked: 0, overCap: false,
671
699
  framed: false, display: null, skipped: [], assumptions: [], references: [], samples: [] };
672
700
  const refuse = (reason, extra = {}) => ({ ...base, status: 'not-applied', reason, ...extra });
@@ -680,18 +708,35 @@ function applyModelView(command, target, operationId = null) {
680
708
  console.error('[revit-editor] an AI view command could not be evaluated', error);
681
709
  return refuse('failed', { total: entities.length });
682
710
  }
711
+ // #4008: a model whose undrawn objects are not all listed answers "not drawn" with nothing, before any search starts.
712
+ const drawnClass = isTeklaParser ? teklaDrawn().class : null;
713
+ const gated = parsed.select?.kind === 'where' ? undrawnGate(parsed.select, drawnClass) : null;
714
+ if (gated) return refuse(gated, { total: entities.length });
683
715
  // A paged model's viewer holds only labels: its properties are searched on the server, and the answer is applied here.
684
716
  if (isTeklaParser && pagedProperties && parsed.select?.kind === 'where') return searchPagedModelView(parsed, target, operationId, base, refuse);
685
717
  return finishModelView(parsed, () => {
686
718
  const candidates = viewCandidates();
687
719
  // What is selected now, as the query compares with it: in Tekla the parts lit in 3D (an assembly picked in the
688
- // tree selects its parts), in Revit the selected objects. Ids are checked against every object of the revision.
720
+ // tree selects its parts) and those not drawn yet, in Revit the selected objects. Ids are checked against every
721
+ // object of the revision.
689
722
  return { total: parsed.select.kind === 'where' ? candidates.length : entities.length,
690
- evaluation: evaluateModelViewQuery(candidates, parsed.select, { selectedIds: isTeklaParser ? [...geometrySelectionIds] : [...selectedIds],
723
+ evaluation: evaluateModelViewQuery(candidates, parsed.select, { selectedIds: comparedSelectionIds(), drawnClass,
691
724
  knownIds: new Set(entityById.keys()), revision: loadedRevisionId, displayUnits: displayUnitControl?.units?.() }) };
692
725
  }, base, refuse);
693
726
  }
694
727
 
728
+ /** The selection a query compares with. */
729
+ function comparedSelectionIds() { return isTeklaParser ? [...geometrySelectionIds, ...undrawnSelectionIds()] : [...selectedIds]; }
730
+
731
+ /**
732
+ * The selection as the person made it (#4008): the rows with the path each was picked by, the object shown, and what they
733
+ * resolve to. A paged search applies only if this is unchanged; two rows that resolve to the same objects are two selections.
734
+ */
735
+ function logicalSelection() {
736
+ return JSON.stringify([selectedIds, (teklaGroupNavigator?.state().selectedItems ?? []).map((item) => item.occurrencePath), selectedId,
737
+ comparedSelectionIds()]);
738
+ }
739
+
695
740
  /* -- #3539: a paged model's property search (PLAN §B.3) ----------------------------------------------------------------
696
741
  The viewer holds only labels, so a `where` query is searched on the server. Before applying the answer, the viewer
697
742
  checks in one synchronous step that nothing it depended on changed: the session, the revision, the selection, the
@@ -706,13 +751,13 @@ const VIEW_SEARCH_DEADLINE_MS = 25_000;
706
751
  /** The locale this page folds text and orders names in, which the server must use for the same answer. */
707
752
  function viewSearchLocale() { try { return new Intl.Collator().resolvedOptions().locale; } catch { return null; } }
708
753
 
709
- /** Each drawn object's colour, in entity order, as a palette and 2-byte codes (0xFFFF: none). */
754
+ /** Each queried object's colour, in entity order, as a palette and 2-byte codes (0xFFFF: none, as an undrawn object has). */
710
755
  function viewSearchColours(where) {
711
756
  if (!where.some((clause) => clause.field === 'colour')) return undefined;
712
757
  const colours = viewport?.entityColours?.() ?? new Map();
713
758
  const palette = [], index = new Map(), bytes = [];
714
759
  for (const entity of entities) {
715
- if (entity?.structuralGrid?.mapping?.kind === 'symmetric' || !(entity.geometry || []).length) continue;
760
+ if (!isTeklaQueryable(entity)) continue;
716
761
  const colour = dominantColour(colours.get(entity.id) || []);
717
762
  let code = 0xffff;
718
763
  if (colour != null) { if (!index.has(colour)) { index.set(colour, palette.length); palette.push(colour); } code = index.get(colour); }
@@ -729,9 +774,8 @@ function cancelModelViewSearch(operationId) {
729
774
  }
730
775
 
731
776
  async function searchPagedModelView(parsed, target, operationId, base, refuse) {
732
- const selectionNow = () => (isTeklaParser ? geometrySelectionIds : selectedIds).join('\n');
733
777
  const context = { session: viewerSessionId, revision: loadedRevisionId, source: loadedSourceDigest, command: viewCommandGeneration,
734
- selection: selectionNow(), units: displayUnitControl?.units?.() ?? null, paged: pagedProperties };
778
+ selection: logicalSelection(), selectedIds: comparedSelectionIds(), units: displayUnitControl?.units?.() ?? null, paged: pagedProperties };
735
779
  const colours = viewSearchColours(parsed.select.where);
736
780
  const controller = new AbortController();
737
781
  const deadline = Date.now() + VIEW_SEARCH_DEADLINE_MS;
@@ -742,7 +786,7 @@ async function searchPagedModelView(parsed, target, operationId, base, refuse) {
742
786
  const response = await fetch(`${context.paged.base}/view-query`, { method: 'POST', credentials: 'same-origin', signal: controller.signal,
743
787
  headers: { 'content-type': 'application/json' },
744
788
  body: JSON.stringify({ viewerSessionId: context.session, sequence: ++viewSearchSequence,
745
- select: { where: parsed.select.where, match: parsed.select.match }, selectedIds: context.selection ? context.selection.split('\n') : [],
789
+ select: { where: parsed.select.where, match: parsed.select.match }, selectedIds: context.selectedIds,
746
790
  displayUnits: context.units, locale: viewSearchLocale(), ...(colours ? { colours } : {}) }) });
747
791
  const json = await response.json().catch(() => null);
748
792
  if (!response.ok || json?.ok !== true) throw new Error(`the search answered ${response.status} ${json?.error ?? ''}`.trim());
@@ -758,7 +802,7 @@ async function searchPagedModelView(parsed, target, operationId, base, refuse) {
758
802
  }
759
803
  // One synchronous step from here to the last change: anything that changed while it searched means nothing applies.
760
804
  const changed = viewerLoading || pagedProperties !== context.paged || viewerSessionId !== context.session || loadedRevisionId !== context.revision
761
- || loadedSourceDigest !== context.source || viewCommandGeneration !== context.command || selectionNow() !== context.selection
805
+ || loadedSourceDigest !== context.source || viewCommandGeneration !== context.command || logicalSelection() !== context.selection
762
806
  || (displayUnitControl?.units?.() ?? null) !== context.units
763
807
  || (colours && JSON.stringify(viewSearchColours(parsed.select.where)) !== JSON.stringify(colours));
764
808
  if (changed || answer?.reason === 'view-changed') return refuse('view-changed', { total: entities.length });
@@ -769,31 +813,36 @@ async function searchPagedModelView(parsed, target, operationId, base, refuse) {
769
813
 
770
814
  /** Apply a parsed command once its selection is known. `evaluate()` gives `{ total, evaluation }` for `parsed.select`. */
771
815
  function finishModelView(parsed, evaluate, base, refuse) {
772
- const selectedNow = () => viewport?.getState?.()?.selectionCount ?? 0;
816
+ const selectedIn3d = () => viewport?.getState?.()?.selectionCount ?? 0;
773
817
  let selection = null, total = entities.length;
818
+ // #4008: what a search of a partly drawn model could not cover, from this page's own verified audit, with every answer.
819
+ const left = isTeklaParser && parsed.select?.kind === 'where' ? teklaDrawn().notListed : 0;
774
820
  try {
775
821
  if (parsed.select) {
776
822
  const answer = evaluate();
777
823
  total = answer.total;
778
824
  const evaluation = answer.evaluation;
779
- if (!evaluation.ok) return refuse(evaluation.reason, { total, field: evaluation.field ?? null, commonFields: evaluation.commonFields ?? null, missing: evaluation.missing ?? 0 });
825
+ if (!evaluation.ok) return refuse(evaluation.reason, { total, field: evaluation.field ?? null, commonFields: evaluation.commonFields ?? null, missing: evaluation.missing ?? 0,
826
+ ...(left && evaluation.reason === 'unknown-field' ? { undrawnNotSearched: left } : {}) });
780
827
  const counts = { total, matched: evaluation.matchedIds.length, noField: evaluation.noField, unchecked: evaluation.unchecked,
781
- references: evaluation.references, assumptions: evaluation.assumptions };
828
+ references: evaluation.references, assumptions: evaluation.assumptions, ...(left ? { undrawnNotSearched: left } : {}) };
782
829
  if (!evaluation.matchedIds.length) return refuse('no-match', counts);
783
- // A Tekla query matched drawn objects already; ids may name an assembly, which the list click's resolver turns into
784
- // its parts (bounded at 5,000). Revit selects the matched objects that have a shape.
830
+ // A Tekla query matched drawn and undrawn objects already; ids may name an assembly, which the list click's resolver
831
+ // turns into its parts (bounded at 5,000). Revit selects the matched objects that have a shape.
785
832
  // A structural grid has no geometry of its own; the viewport draws it, and both click paths select it.
786
833
  const isGrid = (id) => entityById.get(id)?.structuralGrid?.mapping?.kind === 'symmetric';
787
834
  const resolved = isTeklaParser ? teklaGeometrySelection(evaluation.matchedIds, entityById, teklaAssemblyMembers)
788
835
  : evaluation.matchedIds.filter((id) => (entityById.get(id)?.geometry || []).length);
789
836
  const drawable = resolved && [...new Set([...resolved, ...evaluation.matchedIds.filter(isGrid)])];
790
- // The cap counts everything that would be selected, a grid included, before anything changes.
791
- if (!drawable || (isTeklaParser && drawable.length > TEKLA_GEOMETRY_SELECTION_CAP)) return refuse('over-cap', { ...counts, overCap: true });
792
- const drawn = new Set(drawable);
793
- const notDrawable = evaluation.matchedIds.filter((id) => !drawn.has(id)
794
- && !(isTeklaParser && (teklaAssemblyMembers.get(id) || []).some((member) => drawn.has(member)))).length;
795
- if (!drawable.length) return refuse('nothing-drawable', { ...counts, notDrawable });
796
- selection = { ids: isTeklaParser ? evaluation.matchedIds : drawable, drawable, counts: { ...counts, notDrawable } };
837
+ const undrawn = drawable && undrawnOf(evaluation.matchedIds, drawable.length);
838
+ // The cap counts everything that would be selected, a grid and the undrawn objects included, before anything changes.
839
+ if (!undrawn || (isTeklaParser && drawable.length > TEKLA_GEOMETRY_SELECTION_CAP)) return refuse('over-cap', { ...counts, overCap: true });
840
+ const selectable = new Set([...drawable, ...undrawn]);
841
+ const notDrawable = evaluation.matchedIds.filter((id) => !selectable.has(id)
842
+ && !(isTeklaParser && (teklaAssemblyMembers.get(id) || []).some((member) => selectable.has(member)))
843
+ && !(undrawn.length && undrawnOf([id])?.length !== 0)).length;
844
+ if (!selectable.size) return refuse('nothing-drawable', { ...counts, notDrawable });
845
+ selection = { ids: isTeklaParser ? evaluation.matchedIds : drawable, drawable, undrawn, counts: { ...counts, notDrawable } };
797
846
  }
798
847
  } catch (error) {
799
848
  // Nothing has changed yet: a command this viewer cannot evaluate changes nothing, and says so.
@@ -801,36 +850,42 @@ function finishModelView(parsed, evaluate, base, refuse) {
801
850
  return refuse('failed', { total });
802
851
  }
803
852
  const display = parsed.display;
804
- // A display change that works on the selection needs objects selected in 3D, not only rows in a list.
805
- if (displayNeedsSelection(display) && !selection && !selectedNow()) return refuse('selection-required', { total });
853
+ // A display change that works on the selection needs objects selected in 3D, not only rows in a list. With only objects
854
+ // that are not drawn yet selected (#4008), those changes are skipped and the rest still run.
855
+ const in3d = selection ? selection.drawable.length > 0 : selectedIn3d() > 0;
856
+ const notDrawnOnly = !in3d && (selection ? selection.undrawn.length : undrawnSelectionIds().length) > 0;
857
+ if (displayNeedsSelection(display) && !selection && !in3d && !notDrawnOnly) return refuse('selection-required', { total });
806
858
  const skipped = [], applied = [];
807
- const fitSelection = !!selection && display?.fit !== 'none' && display?.fit !== 'all';
859
+ if (notDrawnOnly && displayNeedsSelection(display)) skipped.push('selection-not-drawn');
860
+ const fitSelection = !!selection && in3d && display?.fit !== 'none' && display?.fit !== 'all';
808
861
  // Nothing has changed up to here. From here on, every step is the call a person's click makes.
809
862
  if (selection) {
810
863
  const selected = isTeklaParser ? selectTeklaObjects(selection.ids[0], selection.ids, false, false, 'viewport')
811
864
  : selectRevitEntities(selection.ids[0], selection.ids, false, 'viewport');
812
865
  if (!selected) return refuse('failed', { total });
813
866
  }
814
- const selectionApplied = selection ? (isTeklaParser ? geometrySelectionIds.length : selectedIds.length) : 0;
867
+ const undrawnSelected = selection ? undrawnSelectionIds().length : 0;
868
+ const selectionApplied = selection ? (isTeklaParser ? geometrySelectionIds.length + undrawnSelected : selectedIds.length) : 0;
815
869
  // Framed only when the fit ran: a selection with nothing visible to frame leaves the camera where it was.
816
870
  let framed = false;
817
871
  try {
818
872
  if (fitSelection) framed = facade.dispatch('model.fit-selection') === true;
819
- if (display?.visibility === 'isolate') { facade.dispatch('model.isolate'); applied.push('isolate'); }
820
- if (display?.visibility === 'hide-selected') { facade.dispatch('model.hide-selected'); applied.push('hide-selected'); }
873
+ if (display?.visibility === 'isolate' && in3d) { facade.dispatch('model.isolate'); applied.push('isolate'); }
874
+ if (display?.visibility === 'hide-selected' && in3d) { facade.dispatch('model.hide-selected'); applied.push('hide-selected'); }
821
875
  // The toolbar's Show all also brings back hidden grid levels (its click handler, below).
822
876
  if (display?.visibility === 'show-all') { facade.dispatch('model.show-all'); viewport.setGridHiddenLevels([]); syncGridVisibilityAction(); noteGridVisibilityChange(); applied.push('show-all'); }
823
- if (display?.ghostUnselected != null) { facade.dispatch('model.ghost-unselected.set', display.ghostUnselected); applied.push('ghost'); }
877
+ if (display?.ghostUnselected != null && !(display.ghostUnselected && notDrawnOnly)) { facade.dispatch('model.ghost-unselected.set', display.ghostUnselected); applied.push('ghost'); }
824
878
  if (display?.mode) {
825
879
  if (VIEWER_DISPLAY_MODES.includes(display.mode)) { facade.dispatch('model.display-mode.set', display.mode); applied.push('mode'); }
826
880
  else skipped.push('mode-unsupported');
827
881
  }
828
882
  if (display?.fit === 'all') { facade.dispatch('model.fit'); applied.push('fit-all'); }
829
- else if (display?.fit === 'selection' && !selection && selectedNow()) { framed = facade.dispatch('model.fit-selection') === true; applied.push('fit-selection'); }
883
+ else if (display?.fit === 'selection' && !selection && selectedIn3d()) { framed = facade.dispatch('model.fit-selection') === true; applied.push('fit-selection'); }
830
884
  } catch (error) {
831
885
  console.error('[revit-editor] an AI display change failed part way', error);
832
886
  skipped.push('display-failed');
833
887
  }
888
+ if (!selection && !applied.length && skipped.includes('selection-not-drawn') && !skipped.includes('display-failed')) return refuse('selection-not-drawn', { total });
834
889
  reflectToolbarState();
835
890
  modelPanelBridge?.publishSnapshot();
836
891
  window.__instructor?.notifyChanged();
@@ -840,9 +895,9 @@ function finishModelView(parsed, evaluate, base, refuse) {
840
895
  ...base, ...(selection?.counts ?? {}), total,
841
896
  status: skipped.length ? 'partial' : 'applied', reason: null, skipped,
842
897
  // framed: the view was moved onto the selection (Zoom to the whole model is reported as its own step).
843
- selectionApplied, selectedFinal: state.selectionCount ?? 0, framed,
898
+ selectionApplied, selectedFinal: (state.selectionCount ?? 0) + undrawnSelectionIds().length, framed, ...(undrawnSelected ? { undrawnSelected } : {}),
844
899
  display: { ghostUnselected: facade.ghostUnselected() === true, mode: VIEWER_DISPLAY_MODES.includes(mode) ? mode : 'solid', filtered: state.hasVisibilityFilter === true, applied },
845
- samples: selection ? selection.drawable.slice(0, 10).map((id) => (subjectLabelOf(id) || id).slice(0, 120)) : [],
900
+ samples: selection ? [...selection.drawable, ...selection.undrawn].slice(0, 10).map((id) => (subjectLabelOf(id) || id).slice(0, 120)) : [],
846
901
  };
847
902
  }
848
903
 
@@ -856,7 +911,10 @@ function createTeklaNavigator() {
856
911
  groupCandidatesOfPick: (id) => teklaHierarchy.candidates(id),
857
912
  generation: () => teklaHierarchyGeneration,
858
913
  commitSelection(proposal) {
859
- geometrySelectionIds = [...proposal.geometryIds]; selectedIds = proposal.selectedItems.map((item) => item.entityId);
914
+ const ids = proposal.selectedItems.map((item) => item.entityId);
915
+ const undrawnIds = undrawnOf(ids, proposal.geometryIds.length);
916
+ if (undrawnIds === null) { toast('Not selected: this hierarchy contains more than 5,000 objects that are drawn or not drawn yet. Expand it and select a smaller branch.'); return false; }
917
+ geometrySelectionIds = [...proposal.geometryIds]; selectedIds = ids;
860
918
  if (selectedIds.length) clipSession?.clearSelection?.();
861
919
  selectionOriginGuard.run(() => viewport.setSelection({ ids: geometrySelectionIds }));
862
920
  const primary = proposal.primaryEntityId;
@@ -864,10 +922,12 @@ function createTeklaNavigator() {
864
922
  selectedId = null; selectionOrigin = proposal.origin === 'mesh' ? 'viewport' : 'tree';
865
923
  pagedInspectTask?.controller.abort(); pagedInspectTask = null;
866
924
  inspector.render({ state: 'ready', heading: `${selectedIds.length.toLocaleString()} objects selected`,
867
- sections: [propertySection('Selection', [['Objects', selectedIds.length], ['Geometry objects', geometrySelectionIds.length]])], after: [chatQuestionsSection] });
925
+ sections: [propertySection('Selection', [['Objects', selectedIds.length], ['Geometry objects', geometrySelectionIds.length],
926
+ ...(undrawnIds.length ? [['Not drawn yet', undrawnIds.length]] : [])])], after: [chatQuestionsSection] });
868
927
  updateSelectionActions(); modelPanelBridge?.publishSelection(selectionOrigin); window.__instructor?.notifyChanged();
869
928
  } else inspect(primary, false, true, proposal.origin === 'mesh' ? 'viewport' : 'tree');
870
929
  if (geometrySelectionIds.length && proposal.origin === 'tree') facade?.dispatch('model.fit-selection');
930
+ if (undrawnIds.length) toast(`${teklaUndrawnWords(undrawnIds.length, geometrySelectionIds.length + undrawnIds.length)}.`);
871
931
  else if (!geometrySelectionIds.length && primary) toast('This object has no verified geometry to frame.');
872
932
  return true;
873
933
  },
@@ -1039,7 +1099,7 @@ function renderEntityList(host, values, ownProperties = propertyByEntity, member
1039
1099
  }
1040
1100
  if (values.length > limit) {
1041
1101
  const note = document.createElement('div'); note.className = 'explorer-empty';
1042
- const plain = `Showing first 500 of ${values.length.toLocaleString()} objects. Select the Type to select all visible matching geometry.`;
1102
+ const plain = `Showing first 500 of ${values.length.toLocaleString()} objects. ${isTeklaParser && values.some(isTeklaUndrawn) ? 'Select the Type to select them all.' : 'Select the Type to select all visible matching geometry.'}`;
1043
1103
  note.textContent = followed ? plain.replace(' objects.', ' objects, plus the selected object.') : plain;
1044
1104
  if (followed) note.dataset.plainNote = plain;
1045
1105
  host.append(note);
@@ -1096,12 +1156,12 @@ function renderTeklaTypes(host, values, ownProperties, memberships = teklaAssemb
1096
1156
  node.append(trigger, children); parent.append(node);
1097
1157
  };
1098
1158
  const allBrowsable = values.filter((entity) => {
1099
- if (entity.geometry?.length) return true;
1159
+ if (entity.geometry?.length || isTeklaUndrawn(entity)) return true;
1100
1160
  if (entity.structuralGrid?.mapping?.kind === 'symmetric') return true;
1101
1161
  const groupKind = hierarchy.groupKind(entity.id);
1102
1162
  if (groupKind) return !(groupKind === 'assembly' && entity.assemblyActionable === false) && hierarchy.children.has(entity.id);
1103
1163
  return (entity.nativeKind || entity.typeName) === 'Assembly' && entity.assemblyActionable !== false
1104
- && memberships.get(entity.id)?.some((memberId) => valuesById.get(memberId)?.geometry?.length) === true;
1164
+ && memberships.get(entity.id)?.some((memberId) => valuesById.get(memberId)?.geometry?.length || isTeklaUndrawn(valuesById.get(memberId))) === true;
1105
1165
  });
1106
1166
  const normalized = query.trim().toLocaleLowerCase();
1107
1167
  const browsable = normalized ? allBrowsable.filter((entity) => {
@@ -1247,7 +1307,8 @@ function selectAuditFinding(finding) {
1247
1307
  inspect(finding.entityId, true, true, 'audit');
1248
1308
  facade.dispatch('model.fit-selection');
1249
1309
  } else {
1250
- selectedIds = []; geometrySelectionIds = [];
1310
+ // The same rule as every other pick (#4008): an undrawn object of a properties-only model is selected, not only shown.
1311
+ selectedIds = isTeklaUndrawn(entityById.get(finding.entityId)) ? [finding.entityId] : []; geometrySelectionIds = [];
1251
1312
  selectionOriginGuard.run(() => viewport.setSelection({ ids: [] }));
1252
1313
  inspect(finding.entityId, false, true, 'audit');
1253
1314
  synchronizeTeklaNavigatorSelection();
@@ -1347,7 +1408,9 @@ function updateSelectionActions() {
1347
1408
  if (!control) continue;
1348
1409
  if (command === `${commandPrefix}.fit-selection`) {
1349
1410
  control.disabled = blocked;
1350
- if (blocked) control.dataset.blockedReason = selectedId ? 'This audit object has no 3D location to frame.' : selectedIds.length ? 'This selection has no verified 3D location to frame.' : 'Select a model object first.'; else delete control.dataset.blockedReason;
1411
+ const undrawn = blocked ? undrawnSelectionIds().length : 0;
1412
+ if (undrawn) control.dataset.blockedReason = `${teklaUndrawnWords(undrawn, undrawn)}.`;
1413
+ else if (blocked) control.dataset.blockedReason = selectedId ? 'This audit object has no 3D location to frame.' : selectedIds.length ? 'This selection has no verified 3D location to frame.' : 'Select a model object first.'; else delete control.dataset.blockedReason;
1351
1414
  }
1352
1415
  }
1353
1416
  }
@@ -1723,7 +1786,7 @@ function commitSpatialForRevision(candidate) {
1723
1786
  spatialTools = candidate.tools; clipSession = candidate.clip; candidate.committed = true;
1724
1787
  releaseSpatialViewport = viewport.bindSpatialTools(spatialTools);
1725
1788
  releaseClipViewport = viewport.bindClipSession(clipSession);
1726
- clipList = mountModelClipList({ session: clipSession, host: revitClipListHost, onError: toast });
1789
+ clipList = mountModelClipList({ session: clipSession, host: revitClipListHost, onError: toast, commandPrefix });
1727
1790
  releaseClipEditor = clipSession.subscribe((value) => {
1728
1791
  if (!value.selectedIds.length || !selectedId) return;
1729
1792
  inspect(null);
@@ -1856,7 +1919,8 @@ function wireToolbar() {
1856
1919
  ? readOnlyModelRenderPlan({ commandPrefix, sourceLabel: 'Tekla' })
1857
1920
  : revitRenderPlan();
1858
1921
  const bar = $('m3dBar'); bar.innerHTML = renderToolbarMarkup(plan);
1859
- const chrome = mountToolbarChrome({ toolbar: bar, port: facade, onBeforeOpen: () => { closeSpatialDialog(); selectionFilterChrome?.close(); spatialPanel?.close({ restoreFocus: false }); lightingPanel?.close({ restoreFocus: false }); } });
1922
+ const chrome = mountToolbarChrome({ toolbar: bar, port: facade, onBeforeOpen: () => { closeSpatialDialog(); selectionFilterChrome?.close(); spatialPanel?.close({ restoreFocus: false }); lightingPanel?.close({ restoreFocus: false }); },
1923
+ noSelectionReason: () => { const undrawn = undrawnSelectionIds().length; return undrawn ? `${teklaUndrawnWords(undrawn, undrawn)}.` : ''; } });
1860
1924
  const savedViews = $('revitSavedViews'); savedViews?.setAttribute('aria-haspopup', 'dialog'); savedViews?.setAttribute('aria-expanded', 'false');
1861
1925
  const outsideDialog = (event) => { if (spatialDialog && !spatialDialog.contains(event.target) && !spatialDialog.__anchor?.contains(event.target)) closeSpatialDialog(); };
1862
1926
  document.addEventListener('mousedown', outsideDialog, true);
@@ -1910,9 +1974,32 @@ function restoreLoadingState(host) {
1910
1974
  host.className = loadingStateTemplate.className; host.removeAttribute('role'); delete host.dataset.state;
1911
1975
  }
1912
1976
 
1913
- function renderTeklaNothingDrawnState(host, objectCount, gridDrawn) {
1977
+ // #4008: why objects are not drawn, by the import audit's code. `part-geometry-missing` covers several causes, so its words name
1978
+ // none, and a code this build does not know is counted without one.
1979
+ const TEKLA_UNDRAWN_REASONS = Object.freeze({
1980
+ 'part-geometry-missing': (one) => one ? 'is a part whose shape can’t be built yet' : 'are parts whose shapes can’t be built yet',
1981
+ 'bolt-geometry-missing': (one) => one ? 'is a bolt whose shape can’t be built yet' : 'are bolts whose shapes can’t be built yet',
1982
+ 'weld-geometry-missing': (one) => one ? 'is a weld whose shape can’t be built yet' : 'are welds whose shapes can’t be built yet',
1983
+ 'profile-catalogue-missing': (one) => one ? 'is a part whose profile shape isn’t known because profdb.bin was missing' : 'are parts whose profile shapes aren’t known because profdb.bin was missing',
1984
+ 'bolt-catalogue-missing': (one) => one ? 'is a bolt that needs a missing catalogue file (screwdb.db or assdb.db)' : 'are bolts that need a missing catalogue file (screwdb.db or assdb.db)',
1985
+ 'unsupported-native-type': (one) => one ? 'is of a type that isn’t known yet' : 'are of a type that isn’t known yet',
1986
+ });
1987
+ /** What a properties-only model's notice says: what was read, why nothing is drawn, and where to read the objects. */
1988
+ function teklaPropertiesOnlyBody(count, label, gridDrawn) {
1989
+ const why = (Array.isArray(label.reasons) ? label.reasons : []).map(({ reason, count: n }) => `${Number(n).toLocaleString()} ${
1990
+ Object.hasOwn(TEKLA_UNDRAWN_REASONS, reason) ? TEKLA_UNDRAWN_REASONS[reason](n === 1) : 'can’t be drawn yet'}`);
1991
+ if (label.noGeometry) why.push(`${Number(label.noGeometry).toLocaleString()} ${label.noGeometry === 1 ? 'has' : 'have'} no shape of ${label.noGeometry === 1 ? 'its' : 'their'} own, such as assemblies`);
1992
+ return `${count.toLocaleString()} ${count === 1 ? 'object was' : 'objects were'} read, with the properties that could be read. `
1993
+ + `${gridDrawn ? 'Apart from the grid, none' : 'None'} can be drawn yet: ${new Intl.ListFormat('en', { type: 'conjunction' }).format(why)}. `
1994
+ + 'Select objects in the Type tree to read their properties.';
1995
+ }
1996
+
1997
+ function renderTeklaNothingDrawnState(host, { count: objectCount, gridDrawn, label, filesMissing }) {
1914
1998
  const count = Number(objectCount) || 0;
1915
- renderRevitNoModelState(host, {
1999
+ renderRevitNoModelState(host, label ? {
2000
+ kind: 'nothing-drawn', title: gridDrawn ? 'Nothing drawable yet, except the grid' : 'Nothing drawable yet',
2001
+ body: `${teklaPropertiesOnlyBody(count, label, gridDrawn)}${filesMissing ? ' This copy was read with some files missing, so it cannot be approved. Open the Audit tab in the left panel to see the missing files and the objects they affect.' : ''}`,
2002
+ } : {
1916
2003
  // A structural grid is drawn from its own record, so it can still show when no object can (#1849).
1917
2004
  kind: 'nothing-drawn', title: gridDrawn ? 'Only the grid could be drawn' : 'Nothing in this model could be drawn',
1918
2005
  body: `Tekla Parser read ${count.toLocaleString()} ${count === 1 ? 'object' : 'objects'}, but ${gridDrawn ? 'apart from the grid, none' : 'none'} of them could be drawn in 3D. This copy was read with some files missing, so it cannot be approved. Open the Audit tab in the left panel to see the missing files and the objects they affect.`,
@@ -2007,7 +2094,10 @@ async function loadRevision(state, authority, spatialCandidate) {
2007
2094
  teklaAudit = null; selectedId = null; selectedIds = []; geometrySelectionIds = [];
2008
2095
  // The viewport shows this revision from here, so its notice is this revision's even if a later step
2009
2096
  // of the switch fails.
2010
- loadedNothingDrawn = nothingDrawn ? { count: nextEntities.length, gridDrawn: !!nextStructuralGrid } : null;
2097
+ loadedNothingDrawn = nothingDrawn ? { count: nextEntities.length, gridDrawn: !!nextStructuralGrid,
2098
+ // #4008: AWARE's signed "nothing drawable yet", and whether files were missing too (an older copy has no label).
2099
+ label: manifest.geometryState ?? null, filesMissing: (nextAudit?.sources?.length ?? 0) > 0 } : null;
2100
+ const propertiesOnly = $('modelPropertiesOnly'); if (propertiesOnly) propertiesOnly.hidden = !loadedNothingDrawn?.label;
2011
2101
  loadedRevisionId = handle.revisionId; loadedSourceDigest = handle.sourceSha256;
2012
2102
  entities = nextEntities; properties = nextProperties; relationships = nextRelationships; entityById = nextEntityById; propertyByEntity = nextPropertyByEntity; teklaAudit = nextAudit;
2013
2103
  pagedInspectTask?.controller.abort(); pagedInspectTask = null;
@@ -2031,14 +2121,14 @@ async function loadRevision(state, authority, spatialCandidate) {
2031
2121
  renderTeklaAudit();
2032
2122
  viewerLoading = false;
2033
2123
  modelPanelBridge?.ready(handle.revisionId);
2034
- if (loadedNothingDrawn) renderTeklaNothingDrawnState($('loadingState'), loadedNothingDrawn.count, loadedNothingDrawn.gridDrawn);
2124
+ if (loadedNothingDrawn) renderTeklaNothingDrawnState($('loadingState'), loadedNothingDrawn);
2035
2125
  else $('loadingState').style.display = 'none';
2036
2126
  return true;
2037
2127
  } catch (error) {
2038
2128
  if (token !== revisionLoadToken) return false;
2039
2129
  // A failed switch keeps the last good revision on screen, and with it that revision's own notice.
2040
2130
  if (viewport?.isReady?.()) {
2041
- if (loadedNothingDrawn) renderTeklaNothingDrawnState($('loadingState'), loadedNothingDrawn.count, loadedNothingDrawn.gridDrawn);
2131
+ if (loadedNothingDrawn) renderTeklaNothingDrawnState($('loadingState'), loadedNothingDrawn);
2042
2132
  else $('loadingState').style.display = 'none';
2043
2133
  }
2044
2134
  throw error;
@@ -2065,6 +2155,15 @@ let changeReview = null;
2065
2155
  * #3352: open the saved state a change-review row belongs to (any approved version or the working snapshot), then select
2066
2156
  * the object. The authority toggle shows neither button pressed while a reviewed state other than those two is shown.
2067
2157
  */
2158
+ /** The header's pressed pill for an earlier saved state shown from Change Review; null removes it. */
2159
+ function reviewStatePill(host, label) {
2160
+ host?.querySelector('.authority-review-state')?.remove();
2161
+ if (!host || !label) return;
2162
+ const pill = document.createElement('span');
2163
+ pill.className = 'authority-review-state'; pill.setAttribute('aria-pressed', 'true'); pill.textContent = label;
2164
+ pill.dataset.tip = `${label} is shown. It is an earlier saved state, not the working or the approved snapshot.`;
2165
+ host.append(pill);
2166
+ }
2068
2167
  async function locateChangeReviewObject(state, { state: saved, entityId, entityIds = null }) {
2069
2168
  if (!saved?.handle || !entityId) throw new Error('This object cannot be shown in 3D.');
2070
2169
  if (loadedRevisionId !== saved.handle.revisionId) {
@@ -2081,14 +2180,24 @@ async function locateChangeReviewObject(state, { state: saved, entityId, entityI
2081
2180
  throw new Error(`${saved.label} couldn’t be opened in 3D. The model shown before is still shown.`);
2082
2181
  } finally { candidate?.dispose(); }
2083
2182
  host?.querySelectorAll('button').forEach((button) => button.setAttribute('aria-pressed', String(button.dataset.commandInstanceLabel === key)));
2183
+ // A reviewed state that is neither the working nor the approved one has no button: name it beside them, highlighted.
2184
+ reviewStatePill(host, key === 'reviewState' ? saved.label : null);
2084
2185
  toast(`Showing ${saved.label}.`, 4000);
2085
2186
  }
2086
2187
  // A clash names two parts (#3503): both are selected and shown together; one not drawn is left out, and the other is
2087
2188
  // still shown. It returns the ids it actually selected, so the caller never announces a part that was not shown.
2088
2189
  const selected = (Array.isArray(entityIds) && entityIds.length ? entityIds : [entityId]).filter((id) => entityById.has(id));
2089
- if (!selected.length) throw new Error('This object is not drawn in that saved state.');
2190
+ // A sentence for the person (`said`), which every caller shows as it is: the saved state did open.
2191
+ const notDrawn = (count) => {
2192
+ const said = `${count > 1 ? 'These objects are' : 'This object is'} not drawn in that saved state.`;
2193
+ return Object.assign(new Error(said), { said });
2194
+ };
2195
+ if (!selected.length) throw notDrawn(1);
2090
2196
  selectTeklaObjects(selected.includes(entityId) ? entityId : selected[0], selected);
2091
- return selected;
2197
+ // #4008: an object that is not drawn is selected, so its properties are there to read, but nothing of it is shown in 3D.
2198
+ const shown = selected.filter((id) => !isTeklaUndrawn(entityById.get(id)));
2199
+ if (!shown.length) throw notDrawn(selected.length);
2200
+ return shown;
2092
2201
  }
2093
2202
 
2094
2203
  function mountPanels() {
@@ -2261,6 +2370,7 @@ function authorityButtons(state) {
2261
2370
  candidate = await prepareSpatialForRevision(state, state[key]);
2262
2371
  if (!await loadRevision(state, key, candidate)) return;
2263
2372
  host.querySelectorAll('button').forEach((item) => item.setAttribute('aria-pressed', String(item === button)));
2373
+ reviewStatePill(host, null);
2264
2374
  const findingsChip = document.getElementById('authorityFindings'); if (findingsChip) findingsChip.hidden = key !== 'approved';
2265
2375
  window.__revitInstructorState = { ...(window.__revitInstructorState || {}), authority: key }; window.__instructor?.notifyChanged();
2266
2376
  } catch (error) {
@@ -2306,6 +2416,14 @@ function renderCursorCoordinates() {
2306
2416
  $('modelCursorCoordinates').textContent = ['X', 'Y', 'Z'].map((axis, index) => `${axis} ${lastCursorCoordinates ? displayUnitControl.length(lastCursorCoordinates[index]) : '—'}`).join(' · ');
2307
2417
  }
2308
2418
 
2419
+ /** The FloLess window's model Source step control (workspaces.js `modelSourceStep`), or null outside that window. */
2420
+ function teklaSourceStep() {
2421
+ try {
2422
+ const step = window.parent !== window ? window.parent.flolessWorkspaces?.modelSourceStep : null;
2423
+ return typeof step === 'function' ? step : null;
2424
+ } catch { return null; }
2425
+ }
2426
+
2309
2427
  async function boot() {
2310
2428
  // Refuse an invalid direct-open before creating any of the three WebGL contexts (provider + chrome).
2311
2429
  if (!projectId) throw new Error(`Open this viewer from a ${modelProduct} project workspace.`);
@@ -2384,6 +2502,9 @@ async function boot() {
2384
2502
  if (isTeklaParser && teklaChangesHost) {
2385
2503
  changeReview = mountChangeReview({ host: teklaChangesHost, doc: document, projectId, fetchJson: json,
2386
2504
  locate: (target) => locateChangeReviewObject(state, target),
2505
+ // #4103: "Import the model folder again" presses this project's own Source step Replace in the FloLess window,
2506
+ // the same press a confirmed chat card makes; outside that window there is no Source step, so no button.
2507
+ reimport: teklaSourceStep() ? () => teklaSourceStep()({ verb: 'replace', importer: 'tekla', projectId }) : null,
2387
2508
  onStateChanged: () => { window.__revitInstructorState = { ...(window.__revitInstructorState || {}), changeReview: changeReview?.state() }; window.__instructor?.notifyChanged(); } });
2388
2509
  void changeReview.load();
2389
2510
  }
@@ -58,6 +58,13 @@
58
58
  return `<span class="rh-pill" tabindex="0" data-tip="${esc(tip)}">${e.kind === 'foreign' ? 'Another FloLess' : 'Not checked'}</span>`;
59
59
  }
60
60
 
61
+ // #2470 R6.8 slice 4: a run the person let go ahead past the Teams channel ask says so on its row. The server writes the
62
+ // words (with what its check found for each account, review R3); the page shows them as text and never makes its own.
63
+ function channelAnywayPill(c) {
64
+ if (typeof c.pill !== 'string' || !c.pill || typeof c.tip !== 'string') return '';
65
+ return `<span class="rh-pill" tabindex="0" data-tip="${esc(c.tip)}">${esc(c.pill)}</span>`;
66
+ }
67
+
61
68
  function rowHtml(w, r) {
62
69
  const key = r.runId || `${r.routine?.id || 'routine'}@${r.startedAt}`;
63
70
  const label = `${w.name}, ${when(r.startedAt)}`;
@@ -69,6 +76,7 @@
69
76
  r.aiStep ? `<span class="pg-ai-badge rh-ai" tabindex="0" data-tip="${esc(AI_TIP)}">AI step</span>` : '',
70
77
  r.simulated && r.outcome !== 'simulated' ? `<span class="rh-pill" data-tip="${esc(SIM_TIP)}">Simulated</span>` : '',
71
78
  r.elsewhere ? elsewherePill(r.elsewhere) : '',
79
+ r.channelRunAnyway && typeof r.channelRunAnyway === 'object' ? channelAnywayPill(r.channelRunAnyway) : '',
72
80
  ].join('');
73
81
  const report = r.report && r.runId && !w.damaged && !w.missing
74
82
  ? `<button type="button" class="btn-mini rh-btn" data-rh-report="${esc(r.runId)}" data-rh-app="${esc(w.id)}" data-command-id="shell.workflows-history-report#${esc(r.runId)}" data-command-instance-label="${esc(label)}" aria-label="${esc(`View report: ${label}`)}" data-tip="Opens the report this run made">View report</button>` : '';