@floless/app 0.174.1 → 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 (85) 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 +7 -3
  4. package/dist/pdf-engine/floless_pdf/backend_pdfium.py +292 -13
  5. package/dist/pdf-engine/floless_pdf/backend_pymupdf.py +25 -3
  6. package/dist/pdf-engine/floless_pdf/images.py +4 -3
  7. package/dist/pdf-engine/floless_pdf/pages.py +136 -0
  8. package/dist/schemas/steel.model.v2.schema.json +44 -1
  9. package/dist/skills/floless-app-approval/SKILL.md +28 -3
  10. package/dist/skills/floless-app-knowledge/SKILL.md +3 -2
  11. package/dist/skills/floless-app-sketches/SKILL.md +71 -0
  12. package/dist/skills/floless-app-sketches/references/steel-plate.md +15 -0
  13. package/dist/skills/floless-app-steel-model/SKILL.md +11 -1
  14. package/dist/skills/floless-app-steel-model/references/elements.md +90 -23
  15. package/dist/skills/floless-app-steel-takeoff/SKILL.md +11 -6
  16. package/dist/web/agents.js +1 -1
  17. package/dist/web/app.css +120 -15
  18. package/dist/web/app.js +89 -38
  19. package/dist/web/aware-hold.js +10 -0
  20. package/dist/web/aware.js +405 -51
  21. package/dist/web/boot-watchdog.js +249 -0
  22. package/dist/web/card-details.js +88 -0
  23. package/dist/web/chat.css +29 -0
  24. package/dist/web/chat.js +430 -128
  25. package/dist/web/commands-connection-design.js +23 -0
  26. package/dist/web/commands-revit.js +3 -0
  27. package/dist/web/commands-shell.js +226 -10
  28. package/dist/web/commands-steel.js +93 -4
  29. package/dist/web/commands-tekla-parser.js +21 -1
  30. package/dist/web/connection-design-editor.html +71 -0
  31. package/dist/web/connection-design-editor.js +794 -61
  32. package/dist/web/connection-design-handles.js +9 -3
  33. package/dist/web/element-approval.js +74 -0
  34. package/dist/web/element-context.js +76 -6
  35. package/dist/web/element-geometry.js +8 -2
  36. package/dist/web/element-holds.js +68 -5
  37. package/dist/web/element-type-actions.js +22 -3
  38. package/dist/web/element-types.js +12 -5
  39. package/dist/web/element-words.js +15 -11
  40. package/dist/web/grid-place.js +51 -0
  41. package/dist/web/guide.js +2 -0
  42. package/dist/web/index.html +13 -16
  43. package/dist/web/instructor.js +5 -2
  44. package/dist/web/missed-routines.js +6 -1
  45. package/dist/web/model-change-findings.js +100 -30
  46. package/dist/web/model-change-review.js +411 -27
  47. package/dist/web/model-clash-check.css +100 -0
  48. package/dist/web/model-clash-check.js +681 -0
  49. package/dist/web/model-clip-box.js +204 -0
  50. package/dist/web/model-clip-list.js +153 -3
  51. package/dist/web/model-clip-session.js +3 -3
  52. package/dist/web/model-clip-three-overlay.js +135 -25
  53. package/dist/web/model-editor.css +2 -0
  54. package/dist/web/model-elements.js +273 -18
  55. package/dist/web/model-fit-checks.js +354 -0
  56. package/dist/web/model-spatial-panel.js +9 -3
  57. package/dist/web/model-spatial-tools.js +12 -3
  58. package/dist/web/model-tekla-selection.js +74 -0
  59. package/dist/web/model-view-query.js +70 -14
  60. package/dist/web/model-viewport-revit-adapter.js +8 -7
  61. package/dist/web/model-viewport-toolbar.js +8 -4
  62. package/dist/web/pages.js +78 -1
  63. package/dist/web/project-history.js +31 -1
  64. package/dist/web/revit-editor.css +34 -1
  65. package/dist/web/revit-editor.js +174 -55
  66. package/dist/web/run-history.js +8 -0
  67. package/dist/web/sketch-editor.js +141 -2
  68. package/dist/web/sketches.js +192 -6
  69. package/dist/web/start-place.js +46 -0
  70. package/dist/web/steel-3d-core.js +70 -0
  71. package/dist/web/steel-3d-view.js +288 -47
  72. package/dist/web/steel-change-review.css +28 -0
  73. package/dist/web/steel-custom-connection.js +6 -0
  74. package/dist/web/steel-editor.html +532 -33
  75. package/dist/web/steel-filter.html +8 -3
  76. package/dist/web/steel-model-checks.css +76 -0
  77. package/dist/web/steel-model-v2-commands.js +17 -0
  78. package/dist/web/steel-view-generation.js +6 -2
  79. package/dist/web/teams.js +259 -19
  80. package/dist/web/tekla-editor.html +1 -0
  81. package/dist/web/terminal-requests.js +6 -0
  82. package/dist/web/vendor/connection-engine.js +886 -91
  83. package/dist/web/workspaces.js +630 -48
  84. package/package.json +2 -1
  85. 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';
@@ -335,6 +335,7 @@ const TEKLA_AUDIT_COPY = Object.freeze({
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
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
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.' }),
338
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.' }),
339
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.' }),
340
341
  });
@@ -620,6 +621,26 @@ function resolveTeklaOccurrences(occurrences, { origin = 'tree', operation = 're
620
621
  return { handled: true, accepted: result.ok, reason: result.reason };
621
622
  }
622
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
+
623
644
  function selectTeklaObjects(id, ids, visibleOnly = false, fit = true, origin = 'tree') {
624
645
  if (origin === 'tree' && fit && id && ids.length === 1 && teklaGroupNavigator && entityById.get(id)?.hierarchyContract === 'tekla-hierarchy/v1') {
625
646
  return resolveTeklaOccurrences([{ entityId: id, occurrencePath: [id] }], { origin }).accepted;
@@ -632,15 +653,19 @@ function selectTeklaObjects(id, ids, visibleOnly = false, fit = true, origin = '
632
653
  const gridIds = ids.filter((entityId) => entityById.get(entityId)?.structuralGrid?.mapping?.kind === 'symmetric'
633
654
  && (!visible || visible.has(entityId)));
634
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; }
635
659
  geometrySelectionIds = geometryIds;
636
- selectedIds = geometryIds.length ? [...ids] : [];
660
+ selectedIds = geometryIds.length || undrawnIds.length ? [...ids] : [];
637
661
  if (ids.length) clipSession?.clearSelection?.();
638
662
  selectionOriginGuard.run(() => viewport.setSelection({ ids: geometryIds }));
639
663
  const selected = ids.includes(id) ? id : (ids.at(-1) ?? null);
640
664
  const result = inspect(selected, false, true, origin);
641
665
  synchronizeTeklaNavigatorSelection();
642
- if (geometryIds.length) { if (fit) facade.dispatch('model.fit-selection'); }
643
- 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.');
644
669
  return result;
645
670
  }
646
671
 
@@ -655,9 +680,10 @@ function viewCandidates() {
655
680
  const candidates = [];
656
681
  for (const entity of entities) {
657
682
  if (entity?.structuralGrid?.mapping?.kind === 'symmetric') continue;
658
- // A Tekla query matches the objects that are drawn (parts, bolts): an assembly would bring in every part it holds,
659
- // whatever that part's own profile or length. Revit lists every object and reports those with nothing to draw.
660
- 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;
661
687
  candidates.push(modelViewCandidate(entity, propertyByEntity.get(entity.id) || [], { tekla: isTeklaParser,
662
688
  label: subjectLabelOf(entity.id) || entity.id, colour: dominantColour(colours.get(entity.id) || []) }));
663
689
  }
@@ -668,7 +694,7 @@ function applyModelView(command, target, operationId = null) {
668
694
  // Every command makes an earlier paged search stale (#3539): only the latest one may apply.
669
695
  viewCommandGeneration++;
670
696
  // The viewport's public state (web/model-viewport-state.js): how many objects it shows selected.
671
- const selectedNow = () => viewport?.getState?.()?.selectionCount ?? 0;
697
+ const selectedNow = () => (viewport?.getState?.()?.selectionCount ?? 0) + undrawnSelectionIds().length;
672
698
  const base = { total: 0, matched: 0, selectionApplied: 0, selectedFinal: selectedNow(), notDrawable: 0, noField: 0, unchecked: 0, overCap: false,
673
699
  framed: false, display: null, skipped: [], assumptions: [], references: [], samples: [] };
674
700
  const refuse = (reason, extra = {}) => ({ ...base, status: 'not-applied', reason, ...extra });
@@ -682,18 +708,35 @@ function applyModelView(command, target, operationId = null) {
682
708
  console.error('[revit-editor] an AI view command could not be evaluated', error);
683
709
  return refuse('failed', { total: entities.length });
684
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 });
685
715
  // A paged model's viewer holds only labels: its properties are searched on the server, and the answer is applied here.
686
716
  if (isTeklaParser && pagedProperties && parsed.select?.kind === 'where') return searchPagedModelView(parsed, target, operationId, base, refuse);
687
717
  return finishModelView(parsed, () => {
688
718
  const candidates = viewCandidates();
689
719
  // What is selected now, as the query compares with it: in Tekla the parts lit in 3D (an assembly picked in the
690
- // 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.
691
722
  return { total: parsed.select.kind === 'where' ? candidates.length : entities.length,
692
- evaluation: evaluateModelViewQuery(candidates, parsed.select, { selectedIds: isTeklaParser ? [...geometrySelectionIds] : [...selectedIds],
723
+ evaluation: evaluateModelViewQuery(candidates, parsed.select, { selectedIds: comparedSelectionIds(), drawnClass,
693
724
  knownIds: new Set(entityById.keys()), revision: loadedRevisionId, displayUnits: displayUnitControl?.units?.() }) };
694
725
  }, base, refuse);
695
726
  }
696
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
+
697
740
  /* -- #3539: a paged model's property search (PLAN §B.3) ----------------------------------------------------------------
698
741
  The viewer holds only labels, so a `where` query is searched on the server. Before applying the answer, the viewer
699
742
  checks in one synchronous step that nothing it depended on changed: the session, the revision, the selection, the
@@ -708,13 +751,13 @@ const VIEW_SEARCH_DEADLINE_MS = 25_000;
708
751
  /** The locale this page folds text and orders names in, which the server must use for the same answer. */
709
752
  function viewSearchLocale() { try { return new Intl.Collator().resolvedOptions().locale; } catch { return null; } }
710
753
 
711
- /** 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). */
712
755
  function viewSearchColours(where) {
713
756
  if (!where.some((clause) => clause.field === 'colour')) return undefined;
714
757
  const colours = viewport?.entityColours?.() ?? new Map();
715
758
  const palette = [], index = new Map(), bytes = [];
716
759
  for (const entity of entities) {
717
- if (entity?.structuralGrid?.mapping?.kind === 'symmetric' || !(entity.geometry || []).length) continue;
760
+ if (!isTeklaQueryable(entity)) continue;
718
761
  const colour = dominantColour(colours.get(entity.id) || []);
719
762
  let code = 0xffff;
720
763
  if (colour != null) { if (!index.has(colour)) { index.set(colour, palette.length); palette.push(colour); } code = index.get(colour); }
@@ -731,9 +774,8 @@ function cancelModelViewSearch(operationId) {
731
774
  }
732
775
 
733
776
  async function searchPagedModelView(parsed, target, operationId, base, refuse) {
734
- const selectionNow = () => (isTeklaParser ? geometrySelectionIds : selectedIds).join('\n');
735
777
  const context = { session: viewerSessionId, revision: loadedRevisionId, source: loadedSourceDigest, command: viewCommandGeneration,
736
- selection: selectionNow(), units: displayUnitControl?.units?.() ?? null, paged: pagedProperties };
778
+ selection: logicalSelection(), selectedIds: comparedSelectionIds(), units: displayUnitControl?.units?.() ?? null, paged: pagedProperties };
737
779
  const colours = viewSearchColours(parsed.select.where);
738
780
  const controller = new AbortController();
739
781
  const deadline = Date.now() + VIEW_SEARCH_DEADLINE_MS;
@@ -744,7 +786,7 @@ async function searchPagedModelView(parsed, target, operationId, base, refuse) {
744
786
  const response = await fetch(`${context.paged.base}/view-query`, { method: 'POST', credentials: 'same-origin', signal: controller.signal,
745
787
  headers: { 'content-type': 'application/json' },
746
788
  body: JSON.stringify({ viewerSessionId: context.session, sequence: ++viewSearchSequence,
747
- 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,
748
790
  displayUnits: context.units, locale: viewSearchLocale(), ...(colours ? { colours } : {}) }) });
749
791
  const json = await response.json().catch(() => null);
750
792
  if (!response.ok || json?.ok !== true) throw new Error(`the search answered ${response.status} ${json?.error ?? ''}`.trim());
@@ -760,7 +802,7 @@ async function searchPagedModelView(parsed, target, operationId, base, refuse) {
760
802
  }
761
803
  // One synchronous step from here to the last change: anything that changed while it searched means nothing applies.
762
804
  const changed = viewerLoading || pagedProperties !== context.paged || viewerSessionId !== context.session || loadedRevisionId !== context.revision
763
- || loadedSourceDigest !== context.source || viewCommandGeneration !== context.command || selectionNow() !== context.selection
805
+ || loadedSourceDigest !== context.source || viewCommandGeneration !== context.command || logicalSelection() !== context.selection
764
806
  || (displayUnitControl?.units?.() ?? null) !== context.units
765
807
  || (colours && JSON.stringify(viewSearchColours(parsed.select.where)) !== JSON.stringify(colours));
766
808
  if (changed || answer?.reason === 'view-changed') return refuse('view-changed', { total: entities.length });
@@ -771,31 +813,36 @@ async function searchPagedModelView(parsed, target, operationId, base, refuse) {
771
813
 
772
814
  /** Apply a parsed command once its selection is known. `evaluate()` gives `{ total, evaluation }` for `parsed.select`. */
773
815
  function finishModelView(parsed, evaluate, base, refuse) {
774
- const selectedNow = () => viewport?.getState?.()?.selectionCount ?? 0;
816
+ const selectedIn3d = () => viewport?.getState?.()?.selectionCount ?? 0;
775
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;
776
820
  try {
777
821
  if (parsed.select) {
778
822
  const answer = evaluate();
779
823
  total = answer.total;
780
824
  const evaluation = answer.evaluation;
781
- 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 } : {}) });
782
827
  const counts = { total, matched: evaluation.matchedIds.length, noField: evaluation.noField, unchecked: evaluation.unchecked,
783
- references: evaluation.references, assumptions: evaluation.assumptions };
828
+ references: evaluation.references, assumptions: evaluation.assumptions, ...(left ? { undrawnNotSearched: left } : {}) };
784
829
  if (!evaluation.matchedIds.length) return refuse('no-match', counts);
785
- // A Tekla query matched drawn objects already; ids may name an assembly, which the list click's resolver turns into
786
- // 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.
787
832
  // A structural grid has no geometry of its own; the viewport draws it, and both click paths select it.
788
833
  const isGrid = (id) => entityById.get(id)?.structuralGrid?.mapping?.kind === 'symmetric';
789
834
  const resolved = isTeklaParser ? teklaGeometrySelection(evaluation.matchedIds, entityById, teklaAssemblyMembers)
790
835
  : evaluation.matchedIds.filter((id) => (entityById.get(id)?.geometry || []).length);
791
836
  const drawable = resolved && [...new Set([...resolved, ...evaluation.matchedIds.filter(isGrid)])];
792
- // The cap counts everything that would be selected, a grid included, before anything changes.
793
- if (!drawable || (isTeklaParser && drawable.length > TEKLA_GEOMETRY_SELECTION_CAP)) return refuse('over-cap', { ...counts, overCap: true });
794
- const drawn = new Set(drawable);
795
- const notDrawable = evaluation.matchedIds.filter((id) => !drawn.has(id)
796
- && !(isTeklaParser && (teklaAssemblyMembers.get(id) || []).some((member) => drawn.has(member)))).length;
797
- if (!drawable.length) return refuse('nothing-drawable', { ...counts, notDrawable });
798
- 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 } };
799
846
  }
800
847
  } catch (error) {
801
848
  // Nothing has changed yet: a command this viewer cannot evaluate changes nothing, and says so.
@@ -803,36 +850,42 @@ function finishModelView(parsed, evaluate, base, refuse) {
803
850
  return refuse('failed', { total });
804
851
  }
805
852
  const display = parsed.display;
806
- // A display change that works on the selection needs objects selected in 3D, not only rows in a list.
807
- 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 });
808
858
  const skipped = [], applied = [];
809
- 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';
810
861
  // Nothing has changed up to here. From here on, every step is the call a person's click makes.
811
862
  if (selection) {
812
863
  const selected = isTeklaParser ? selectTeklaObjects(selection.ids[0], selection.ids, false, false, 'viewport')
813
864
  : selectRevitEntities(selection.ids[0], selection.ids, false, 'viewport');
814
865
  if (!selected) return refuse('failed', { total });
815
866
  }
816
- 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;
817
869
  // Framed only when the fit ran: a selection with nothing visible to frame leaves the camera where it was.
818
870
  let framed = false;
819
871
  try {
820
872
  if (fitSelection) framed = facade.dispatch('model.fit-selection') === true;
821
- if (display?.visibility === 'isolate') { facade.dispatch('model.isolate'); applied.push('isolate'); }
822
- 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'); }
823
875
  // The toolbar's Show all also brings back hidden grid levels (its click handler, below).
824
876
  if (display?.visibility === 'show-all') { facade.dispatch('model.show-all'); viewport.setGridHiddenLevels([]); syncGridVisibilityAction(); noteGridVisibilityChange(); applied.push('show-all'); }
825
- 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'); }
826
878
  if (display?.mode) {
827
879
  if (VIEWER_DISPLAY_MODES.includes(display.mode)) { facade.dispatch('model.display-mode.set', display.mode); applied.push('mode'); }
828
880
  else skipped.push('mode-unsupported');
829
881
  }
830
882
  if (display?.fit === 'all') { facade.dispatch('model.fit'); applied.push('fit-all'); }
831
- 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'); }
832
884
  } catch (error) {
833
885
  console.error('[revit-editor] an AI display change failed part way', error);
834
886
  skipped.push('display-failed');
835
887
  }
888
+ if (!selection && !applied.length && skipped.includes('selection-not-drawn') && !skipped.includes('display-failed')) return refuse('selection-not-drawn', { total });
836
889
  reflectToolbarState();
837
890
  modelPanelBridge?.publishSnapshot();
838
891
  window.__instructor?.notifyChanged();
@@ -842,9 +895,9 @@ function finishModelView(parsed, evaluate, base, refuse) {
842
895
  ...base, ...(selection?.counts ?? {}), total,
843
896
  status: skipped.length ? 'partial' : 'applied', reason: null, skipped,
844
897
  // framed: the view was moved onto the selection (Zoom to the whole model is reported as its own step).
845
- selectionApplied, selectedFinal: state.selectionCount ?? 0, framed,
898
+ selectionApplied, selectedFinal: (state.selectionCount ?? 0) + undrawnSelectionIds().length, framed, ...(undrawnSelected ? { undrawnSelected } : {}),
846
899
  display: { ghostUnselected: facade.ghostUnselected() === true, mode: VIEWER_DISPLAY_MODES.includes(mode) ? mode : 'solid', filtered: state.hasVisibilityFilter === true, applied },
847
- 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)) : [],
848
901
  };
849
902
  }
850
903
 
@@ -858,7 +911,10 @@ function createTeklaNavigator() {
858
911
  groupCandidatesOfPick: (id) => teklaHierarchy.candidates(id),
859
912
  generation: () => teklaHierarchyGeneration,
860
913
  commitSelection(proposal) {
861
- 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;
862
918
  if (selectedIds.length) clipSession?.clearSelection?.();
863
919
  selectionOriginGuard.run(() => viewport.setSelection({ ids: geometrySelectionIds }));
864
920
  const primary = proposal.primaryEntityId;
@@ -866,10 +922,12 @@ function createTeklaNavigator() {
866
922
  selectedId = null; selectionOrigin = proposal.origin === 'mesh' ? 'viewport' : 'tree';
867
923
  pagedInspectTask?.controller.abort(); pagedInspectTask = null;
868
924
  inspector.render({ state: 'ready', heading: `${selectedIds.length.toLocaleString()} objects selected`,
869
- 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] });
870
927
  updateSelectionActions(); modelPanelBridge?.publishSelection(selectionOrigin); window.__instructor?.notifyChanged();
871
928
  } else inspect(primary, false, true, proposal.origin === 'mesh' ? 'viewport' : 'tree');
872
929
  if (geometrySelectionIds.length && proposal.origin === 'tree') facade?.dispatch('model.fit-selection');
930
+ if (undrawnIds.length) toast(`${teklaUndrawnWords(undrawnIds.length, geometrySelectionIds.length + undrawnIds.length)}.`);
873
931
  else if (!geometrySelectionIds.length && primary) toast('This object has no verified geometry to frame.');
874
932
  return true;
875
933
  },
@@ -1041,7 +1099,7 @@ function renderEntityList(host, values, ownProperties = propertyByEntity, member
1041
1099
  }
1042
1100
  if (values.length > limit) {
1043
1101
  const note = document.createElement('div'); note.className = 'explorer-empty';
1044
- 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.'}`;
1045
1103
  note.textContent = followed ? plain.replace(' objects.', ' objects, plus the selected object.') : plain;
1046
1104
  if (followed) note.dataset.plainNote = plain;
1047
1105
  host.append(note);
@@ -1098,12 +1156,12 @@ function renderTeklaTypes(host, values, ownProperties, memberships = teklaAssemb
1098
1156
  node.append(trigger, children); parent.append(node);
1099
1157
  };
1100
1158
  const allBrowsable = values.filter((entity) => {
1101
- if (entity.geometry?.length) return true;
1159
+ if (entity.geometry?.length || isTeklaUndrawn(entity)) return true;
1102
1160
  if (entity.structuralGrid?.mapping?.kind === 'symmetric') return true;
1103
1161
  const groupKind = hierarchy.groupKind(entity.id);
1104
1162
  if (groupKind) return !(groupKind === 'assembly' && entity.assemblyActionable === false) && hierarchy.children.has(entity.id);
1105
1163
  return (entity.nativeKind || entity.typeName) === 'Assembly' && entity.assemblyActionable !== false
1106
- && 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;
1107
1165
  });
1108
1166
  const normalized = query.trim().toLocaleLowerCase();
1109
1167
  const browsable = normalized ? allBrowsable.filter((entity) => {
@@ -1249,7 +1307,8 @@ function selectAuditFinding(finding) {
1249
1307
  inspect(finding.entityId, true, true, 'audit');
1250
1308
  facade.dispatch('model.fit-selection');
1251
1309
  } else {
1252
- 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 = [];
1253
1312
  selectionOriginGuard.run(() => viewport.setSelection({ ids: [] }));
1254
1313
  inspect(finding.entityId, false, true, 'audit');
1255
1314
  synchronizeTeklaNavigatorSelection();
@@ -1349,7 +1408,9 @@ function updateSelectionActions() {
1349
1408
  if (!control) continue;
1350
1409
  if (command === `${commandPrefix}.fit-selection`) {
1351
1410
  control.disabled = blocked;
1352
- 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;
1353
1414
  }
1354
1415
  }
1355
1416
  }
@@ -1725,7 +1786,7 @@ function commitSpatialForRevision(candidate) {
1725
1786
  spatialTools = candidate.tools; clipSession = candidate.clip; candidate.committed = true;
1726
1787
  releaseSpatialViewport = viewport.bindSpatialTools(spatialTools);
1727
1788
  releaseClipViewport = viewport.bindClipSession(clipSession);
1728
- clipList = mountModelClipList({ session: clipSession, host: revitClipListHost, onError: toast });
1789
+ clipList = mountModelClipList({ session: clipSession, host: revitClipListHost, onError: toast, commandPrefix });
1729
1790
  releaseClipEditor = clipSession.subscribe((value) => {
1730
1791
  if (!value.selectedIds.length || !selectedId) return;
1731
1792
  inspect(null);
@@ -1858,7 +1919,8 @@ function wireToolbar() {
1858
1919
  ? readOnlyModelRenderPlan({ commandPrefix, sourceLabel: 'Tekla' })
1859
1920
  : revitRenderPlan();
1860
1921
  const bar = $('m3dBar'); bar.innerHTML = renderToolbarMarkup(plan);
1861
- 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)}.` : ''; } });
1862
1924
  const savedViews = $('revitSavedViews'); savedViews?.setAttribute('aria-haspopup', 'dialog'); savedViews?.setAttribute('aria-expanded', 'false');
1863
1925
  const outsideDialog = (event) => { if (spatialDialog && !spatialDialog.contains(event.target) && !spatialDialog.__anchor?.contains(event.target)) closeSpatialDialog(); };
1864
1926
  document.addEventListener('mousedown', outsideDialog, true);
@@ -1912,9 +1974,32 @@ function restoreLoadingState(host) {
1912
1974
  host.className = loadingStateTemplate.className; host.removeAttribute('role'); delete host.dataset.state;
1913
1975
  }
1914
1976
 
1915
- 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 }) {
1916
1998
  const count = Number(objectCount) || 0;
1917
- 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
+ } : {
1918
2003
  // A structural grid is drawn from its own record, so it can still show when no object can (#1849).
1919
2004
  kind: 'nothing-drawn', title: gridDrawn ? 'Only the grid could be drawn' : 'Nothing in this model could be drawn',
1920
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.`,
@@ -2009,7 +2094,10 @@ async function loadRevision(state, authority, spatialCandidate) {
2009
2094
  teklaAudit = null; selectedId = null; selectedIds = []; geometrySelectionIds = [];
2010
2095
  // The viewport shows this revision from here, so its notice is this revision's even if a later step
2011
2096
  // of the switch fails.
2012
- 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;
2013
2101
  loadedRevisionId = handle.revisionId; loadedSourceDigest = handle.sourceSha256;
2014
2102
  entities = nextEntities; properties = nextProperties; relationships = nextRelationships; entityById = nextEntityById; propertyByEntity = nextPropertyByEntity; teklaAudit = nextAudit;
2015
2103
  pagedInspectTask?.controller.abort(); pagedInspectTask = null;
@@ -2033,14 +2121,14 @@ async function loadRevision(state, authority, spatialCandidate) {
2033
2121
  renderTeklaAudit();
2034
2122
  viewerLoading = false;
2035
2123
  modelPanelBridge?.ready(handle.revisionId);
2036
- if (loadedNothingDrawn) renderTeklaNothingDrawnState($('loadingState'), loadedNothingDrawn.count, loadedNothingDrawn.gridDrawn);
2124
+ if (loadedNothingDrawn) renderTeklaNothingDrawnState($('loadingState'), loadedNothingDrawn);
2037
2125
  else $('loadingState').style.display = 'none';
2038
2126
  return true;
2039
2127
  } catch (error) {
2040
2128
  if (token !== revisionLoadToken) return false;
2041
2129
  // A failed switch keeps the last good revision on screen, and with it that revision's own notice.
2042
2130
  if (viewport?.isReady?.()) {
2043
- if (loadedNothingDrawn) renderTeklaNothingDrawnState($('loadingState'), loadedNothingDrawn.count, loadedNothingDrawn.gridDrawn);
2131
+ if (loadedNothingDrawn) renderTeklaNothingDrawnState($('loadingState'), loadedNothingDrawn);
2044
2132
  else $('loadingState').style.display = 'none';
2045
2133
  }
2046
2134
  throw error;
@@ -2067,6 +2155,15 @@ let changeReview = null;
2067
2155
  * #3352: open the saved state a change-review row belongs to (any approved version or the working snapshot), then select
2068
2156
  * the object. The authority toggle shows neither button pressed while a reviewed state other than those two is shown.
2069
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
+ }
2070
2167
  async function locateChangeReviewObject(state, { state: saved, entityId, entityIds = null }) {
2071
2168
  if (!saved?.handle || !entityId) throw new Error('This object cannot be shown in 3D.');
2072
2169
  if (loadedRevisionId !== saved.handle.revisionId) {
@@ -2083,14 +2180,24 @@ async function locateChangeReviewObject(state, { state: saved, entityId, entityI
2083
2180
  throw new Error(`${saved.label} couldn’t be opened in 3D. The model shown before is still shown.`);
2084
2181
  } finally { candidate?.dispose(); }
2085
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);
2086
2185
  toast(`Showing ${saved.label}.`, 4000);
2087
2186
  }
2088
2187
  // A clash names two parts (#3503): both are selected and shown together; one not drawn is left out, and the other is
2089
2188
  // still shown. It returns the ids it actually selected, so the caller never announces a part that was not shown.
2090
2189
  const selected = (Array.isArray(entityIds) && entityIds.length ? entityIds : [entityId]).filter((id) => entityById.has(id));
2091
- 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);
2092
2196
  selectTeklaObjects(selected.includes(entityId) ? entityId : selected[0], selected);
2093
- 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;
2094
2201
  }
2095
2202
 
2096
2203
  function mountPanels() {
@@ -2263,6 +2370,7 @@ function authorityButtons(state) {
2263
2370
  candidate = await prepareSpatialForRevision(state, state[key]);
2264
2371
  if (!await loadRevision(state, key, candidate)) return;
2265
2372
  host.querySelectorAll('button').forEach((item) => item.setAttribute('aria-pressed', String(item === button)));
2373
+ reviewStatePill(host, null);
2266
2374
  const findingsChip = document.getElementById('authorityFindings'); if (findingsChip) findingsChip.hidden = key !== 'approved';
2267
2375
  window.__revitInstructorState = { ...(window.__revitInstructorState || {}), authority: key }; window.__instructor?.notifyChanged();
2268
2376
  } catch (error) {
@@ -2308,6 +2416,14 @@ function renderCursorCoordinates() {
2308
2416
  $('modelCursorCoordinates').textContent = ['X', 'Y', 'Z'].map((axis, index) => `${axis} ${lastCursorCoordinates ? displayUnitControl.length(lastCursorCoordinates[index]) : '—'}`).join(' · ');
2309
2417
  }
2310
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
+
2311
2427
  async function boot() {
2312
2428
  // Refuse an invalid direct-open before creating any of the three WebGL contexts (provider + chrome).
2313
2429
  if (!projectId) throw new Error(`Open this viewer from a ${modelProduct} project workspace.`);
@@ -2386,6 +2502,9 @@ async function boot() {
2386
2502
  if (isTeklaParser && teklaChangesHost) {
2387
2503
  changeReview = mountChangeReview({ host: teklaChangesHost, doc: document, projectId, fetchJson: json,
2388
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,
2389
2508
  onStateChanged: () => { window.__revitInstructorState = { ...(window.__revitInstructorState || {}), changeReview: changeReview?.state() }; window.__instructor?.notifyChanged(); } });
2390
2509
  void changeReview.load();
2391
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>` : '';