Skip to content

Latest commit

 

History

History
397 lines (327 loc) · 24.4 KB

cli.md

File metadata and controls

397 lines (327 loc) · 24.4 KB
title Command line and exit codes

Command line and exit codes

The tdbio tool (package TdbIO.Cli) reports the structure of a file. It prints text or JSON to standard output, writes messages and warnings to standard error and tells success from failure by its exit code. It uses only the public API of the library.

Usage: tdbio info <file> [--json] [--encoding ascii|utf-8|cp1251|cp1252]
       tdbio tables <file> [--json]
       tdbio text <file> [--json] [--pool-save-stamps]
       tdbio history <file> [--json]
       tdbio export <file> [output] [--indent] [--project-metadata] [--scene-json] [--ifc] [--html]
              [--encoding ascii|utf-8|cp1251|cp1252] [--profile-catalog <file>]
              [--shape-catalog <path>] [--round-bar-alias <prefix>] [--rebar-catalog <file>]
              [--rebar-model-options <file>] [--transparent-parts] [--model-views] [--grid-axes]
              [--task-schedule] [--task-scenario <id>]
       tdbio --help | -h | --version

Commands

Command Works on Output
tdbio info <file> every supported kind key: value lines: the kind, its main values and the number of warnings.
tdbio tables <file> model databases (.db1), DBV@ files A tab-separated header line, then one line per table section.
tdbio text <file> model databases (.db1) A tab-separated header line, then one line per text chain, then one line per orphan row.
tdbio history <file> model history (history.db) Two tab-separated tables of revisions and object actions.
tdbio export <file> [output] model databases (.db1), drawing snapshots (.dg.dpm), profile catalogs (profdb.bin), shape definitions and geometries (.xml, .tez) Native JSON. For model databases, use --ifc for IFC, --scene-json for IOScene JSON or --html for a standalone viewer. An .ifc, .html or .htm destination selects the corresponding format when no format option is given.
tdbio --help, tdbio -h The usage text, on standard output.
tdbio --version tdbio <version>, for example tdbio 0.2.0.

The command comes first. Options may come before or after the file. Detection checks the content. Reports use the .xsr extension. Grid preset detection checks both the extension and the property fields.

Options

Option Commands Effect
--json all Write one indented JSON object (UTF-8) instead of text.
--pool-save-stamps text Lists the string pool's save stamps by head ID, row offset, and saved date and time. JSON uses the poolSaveStamps array.
--encoding <name> info, export Sets the text encoding for templates, reports, model databases, DBV@ files, drawing snapshots, profile catalogs and grid presets. Accepted values are ascii, utf-8, cp1251 and cp1252. The option applies to the snapshot title, graphic text and resource names.
--profile-catalog <file> export --scene-json, export --html Uses I-sections, angles, channels, hollow sections, fixed outlines, numeric slab thicknesses and proxy dimensions from the supplied catalog with an exact, case-sensitive profile name.
--project-metadata Native .db1 JSON export Includes saved project information, active phases, base points, reference models with their source paths and revisions, and saved planning data.
--shape-catalog <path> export --scene-json, export --html Draws catalog items using a model folder or Tekla .tsc shape archive. Repeat the option in priority order.
--round-bar-alias <prefix> DB1 JSON and HTML exports Uses an exact additional profile prefix for a solid round bar with a single diameter in millimetres. Repeat for other aliases. Use the definitions from the model's environment.
--transparent-parts DB1 scene JSON and HTML export Displays model parts at 50% opacity unless the saved representation hides them. Other objects retain their own opacity.
--grid-axes DB1 scene JSON and HTML export Includes labeled straight grid axes at their saved base elevations.
--task-schedule DB1 scene JSON and HTML export Includes saved planning tasks and their assignments to scene elements. HTML requires a single scenario for playback.
--task-scenario <id> DB1 scene JSON and HTML export Enables schedule export and selects a saved scenario by ID. Use 0 to select tasks without a resolved scenario.
--model-views DB1 scene JSON and HTML export Includes named saved views with the stored projection and cameras framed from the axes selected by the saved display orientation and the work area. The HTML viewer restores the work area, applies the view depth for axis-aligned planes and restores saved part, bolt passage, weld and reinforcement visibility. Objects with a decoded connection or macro component in their parent chain use the component switches.
--rebar-catalog <file> export --scene-json, export --html Draws supported reinforcement with its actual diameter from the supplied rebar_database.inp.
--rebar-model-options <file> export --scene-json, export --html, with --rebar-catalog Uses the matching model's options_model.db for supported plane-cut reinforcement.

Options other than --shape-catalog and --round-bar-alias can be given once.

Use tdbio export model.db1 viewer.html --task-schedule --reference-models to inspect the 4D schedule and the assignments it makes to external model objects. When the DB1 contains more than one scenario, the HTML exporter lists the available IDs for --task-scenario. Scene JSON keeps each scenario as a separate schedule.

Use --encoding cp1252 for a model saved with a Western European code page when detection reports cp1251. A byte outside the selected encoding is an input error. For model drawing text under info, the command reports a warning and omits the drawing count.

tdbio info grid.grd --json reports the saved coordinate expressions, labels, magnetism value and its enable switch. When present, origin is ordered X, Y, Z and extensions contains the left and right values for X, Y and Z in that order. With a .rgrd file, info reports the radius, angle and elevation expressions and their labels. With a .grdp file, it reports the saved line label, depth, any extension pairs in file order, and the magnetism and drawing visibility values and enable switches.

With --model-views in HTML export, an exact saved filter name selects a local attributes/<name>.VObjGrp file next to the DB1. The viewer combines supported rules with each view's object-type visibility. A missing local standard file uses the saved type visibility. Missing custom files and unsupported groups produce warnings. Scene JSON carries the saved viewpoint cameras. With --reference-models, a saved view also hides or shows the included reference objects.

When all named views share one representation, the export loads the matching attributes/<name>.rep and its local .PObjGrp files. Supported custom RGB and color-by-class rows apply throughout that export. Visibility codes from 0 to 10 set the opacity from 0% to 100% in 10-point increments. Objects hidden by the representation retain their properties and have no drawable geometry. A row with visibility В«As isВ» is ignored. A row with color В«As isВ» can set opacity and let a lower matching row determine the color. An unsupported color uses the object's default color and still applies the saved opacity.

Model history

tdbio history history.db --json

The JSON output contains revisions and objectActions. Each action links a revision ID and a history item ID to the object's model GUID, type and stored action code. actionKind reports added, modified, removed, or unknown alongside the raw actionCode. creationTimeGuid and actionTimeGuid carry the GUIDs stored for the item's creation and for the action. Revision times are raw stored values. The command reads the main SQLite file from a saved model. Journal and write-ahead log contents are outside this snapshot.

Profile catalog export

tdbio info profdb.bin --json
tdbio export profdb.bin profiles.json --indent

The version 10 catalog JSON includes the section headers, fixed-profile definitions, name index, numeric properties and the eight raw trailer bytes as Base64. Duplicate names remain in the index.

Pass a catalog explicitly to use its dimensions in a scene or viewer export.

tdbio export model.db1 model.html --profile-catalog profdb.bin

For straight parts with a supported position, the viewer can extrude symmetric I-sections from the catalog, including root radii and the center shift relative to the reference line. Centered parts can use circular or rectangular hollow sections from the catalog. Named fixed outlines also support a polygonal or circular exterior with circular through holes. The native D and PD profile parameters also define centered round parts. Supported contour slabs use their numeric thickness when the supplied model catalog has no profile with that name. Straight angles use the catalog radii when the saved placement and nominal dimensions agree with the profile. For parts using rectangular proxies, the catalog supplies height and width when both resolve by exact profile name. The usual profile-name estimate applies when no unambiguous pair is available. For straight rectangular members with both horizontal and vertical convex contour cuts, the viewer can retry the cuts together when applying the vertical cuts to the layered mesh leaves it unchanged. If the first assembly of the cut mesh fails, the adapter can join intersection vertices within two nanometres per coordinate and triangulate narrow concave facets. It accepts the result only if every directed edge has a matching reverse edge.

Circular plate edges use a 0.5 mm target for the deviation between an arc and its chords, with an angular step of at most five degrees and a limit of 1,024 subdivisions per arc.

The parametric L135×85×10 section with a supported placement uses a 15 mm root radius and straight toes. A matching catalog definition supplies its own radii.

Shape file export

tdbio info shape.xml --json
tdbio export geometry.tez geometry.json --indent

Definition JSON gives the shape GUID and the separate geometry storage GUID. Geometry JSON preserves the stored points, zero-based outer and inner face loops, and explicit edges. Supported item parts include catalogShapeId in model JSON.

tdbio export model.db1 model.html --shape-catalog . --shape-catalog panel.tsc

The model folder supplies Shapes and ShapeGeometries. A .tsc file supplies the single shape exported by Tekla. The viewer draws the shape mesh for items with a resolved GUID and a supported local frame. An item with an unresolved shape or placement can still use the rectangular proxy. Open catalog meshes are displayed as surfaces.

Reinforcement export

tdbio export model.db1 model.html --rebar-catalog rebar_database.inp

The same option works with a .scene.json output file. The exporter matches the stored grade and size exactly and uses the catalog's actual diameter column. It draws supported straight and single-bend bars and U-shaped bars without hooks or with two identical outward semicircular hooks. It draws supported straight, single-bend and hook-free U-shaped groups with explicit counts or intervals, using one mesh per group and one instance per bar.

Supported generated straight groups also use the saved grade and size, including a literal Undefined grade when the catalog has a matching entry. Supply the matching model options to display supported groups whose bars end at different positions after a plane cut.

tdbio export model.db1 model.scene.json --rebar-catalog rebar_database.inp --rebar-model-options options_model.db

Drawing snapshot export

tdbio export sheet.dg.dpm sheet.json --indent

Omitting the destination writes JSON to standard output. The JSON includes the snapshot header and views in file order. Each view has a header and an objects array. Object entries include typed graphic collections, commands in their stored order and the original object record encoded as Base64. Command offsets are byte positions in the source snapshot. Their kind, firstIndex and itemCount locate the decoded entries. See the snapshot API for the graphic fields.

Geometry warnings of an export

Scene JSON and HTML build meshes for supported centered base plates with simple contours, including concave ones. Their boundaries are available in the native model JSON. Scene JSON and HTML also reconstruct supported straight I-sections and round sections, solid rectangular sections, and the supported parametric angle. The optional profile catalog adds fixed angles, parallel channels and rectangular hollow sections. When a narrower type-38 round operand meets the end of its host on the same axis, the scene shows one stepped solid. Supported native tapered PHI sections with equal flanges are extruded from their two end heights. Centered hollow round polybeams and centered rectangular bends follow their stored straight and circular path edges. Rectangular sections on supported horizontal arcs use their saved height and radial offsets. Scene and HTML reconstruct supported sharp single-fold BPL plates from both legs and the inner miter. The bolt cutter uses a fold leg when the saved penetration agrees with both of its faces. A shared axial shift within the native anchor tolerance is accepted when the two saved boundaries still agree with the fold leg thickness. The cut uses the reconstructed face positions. Confirmed openings that reach the crease use the nominal leg planes to place the cutter. When a validated additional hole boundary extends past the inner leg plane, it sets the end of the cutter. For supported I-section holes at the web-to-flange fillet, the cutter uses the nominal web thickness. A slot across the I-section width at the flange-to-web junction uses the two nominal width faces. A slot directed through the flange thickness uses the flange identified by its saved boundary pair. The remaining scene parts and the IFC output use rectangular proxies between part endpoints. They estimate the width and height from the profile name, with a default of 150 mm × 150 mm. The proxy requires two endpoints at least 0.001 mm apart. IFC keeps the element when it has no body. On reconstructed straight sections, Scene and HTML fit the nearer end of the stored axis to a resolved fitting plane. The new end can be skew or extend the section. The most recently created fitting relationship on each end takes precedence. Conflicting planes with indistinguishable creation times leave that end at its base position. The fitted faces must leave positive axial separation across the section. On supported rectangular arcs, a vertical fitting plane through one reference endpoint sets the angles where the inner and outer curved faces meet that plane. Scene, HTML and IFC omit linked cutting tools as separate elements. Scene and HTML subtract supported straight-edged PL and BL cuts from centered plates when the tool passes through both faces. Inclined tools use separate face sections when the boundary topology stays constant through the thickness. The remaining plate may have holes, altered outer edges or separate pieces in one mesh. Supported horizontal BL tools can remove partial layers from centered horizontal plates. Horizontal plate tools also apply to supported straight or curved rectangular prisms. Each supported tool uses its own height interval. A numeric plate tool uses the supplied catalog to resolve its thickness, including a form 2 contour cutter with the default positioning. A cut that consumes the entire body leaves the scene element with no mesh. IFC still exports its proxy boxes. On straight rectangular sections, convex vertical BL and PL tools can cut through the full depth after fittings and horizontal cuts. Plane cuts on reconstructed plates, straight profiles and swept polybeams keep the side opposite the stored normal. The scene subtracts supported triangular type-39 bevel tools and draws the resulting sloped faces. They follow end fittings and plate cutouts. New faces close the clipped body and preserve holes in the section. Straight PL tools then subtract their finite rectangular solids from reconstructed meshes. Reconstructed straight catalog profiles also support bounded convex plate-shaped cut operands with straight edges. Supported solid round tools use a 24-sided section and the stored depth. Centered catalog I-section tools use the same flange, web and sampled root radii as the reconstructed member. Supported perpendicular fittings set the ends of the tool before subtraction. The adapter accepts the cut when it can assemble a closed result. If a pocket cannot be closed by the general subtraction, the adapter uses the tool's cross-section and finite depth for targets with matching end contours perpendicular to the tool. This also applies to inclined plates. On straight rectangular parts, the exporter then applies centered PRMD tools whose end sections open entirely within one planar face. The pocket must avoid other faces and other supported pockets. These outputs are intended for viewing. Geometry warnings go to standard error and leave the exit code unchanged.

All three exports report the number of proxy boxes when any are used. The scene JSON export (--scene-json) and the HTML viewer export build the scene of the TdbIO.Scene adapter and then also print, each after a summary line, one line per part whose box has the default dimensions and one line per part with no usable geometry (no start or end point, or a degenerate axis). A part is named by its GUID, or part:{id} when it has none. Up to 20 parts per kind are listed; the summary line counts them all, and the full list is in TdbSceneResult.GeometryDiagnostics. The IFC export prints only the line with the number of boxes.

Exit codes

Code Name Meaning
0 done The command finished and its output was written. Warnings do not change the code.
1 usage The command line is wrong: no command, an unknown command or option, no file, an empty file name, an extra argument, an option repeated, --encoding without a value or with an unknown one, or --encoding for an unsupported file kind. Two lines on standard error: tdbio: <problem> and Run 'tdbio --help' for usage.
2 input The file cannot be used: it does not exist or cannot be read, is not recognised, is cut or malformed, is over a limit, is not supported (an unsupported drawing version, UTF-16 text), or is of a kind the command does not handle (for example tables on a .nc1 file). One line on standard error, tdbio: <problem>, no stack trace.

The whole output is built before anything is written, so a failing command writes nothing to standard output. A message about malformed data ends with the offset of the problem, for example tdbio: not a recognised Tekla file at offset 0x0.

Warnings are written after the output, one line each: tdbio: warning: <warning>. They name an offset, a line, or, for the geometry warnings, a part by its GUID or number, never text from the file.

info

The first key is kind, the name of the TdbFileKind value. In text output the last key is warnings, the number of warnings; in JSON output warnings is the list of warning lines. A value that is not there is - in text and null in JSON.

Kind Keys
Db1 version, modelGuid, idMapEntries, idMapField65 (hex in text), idMapField73, drawings (the rows of the drawing table that are not deleted or superseded), textSections, textChains, saveStamps, lastSavedAt (the latest save stamp date)
Db2 version, modelGuid, records, rows (the sum of the row counts)
Drawing version, headerEntries (including the last entry), contentOffset and contentLength in unpacked bytes
DrawingLayout version, headerEntries (including the last entry), contentOffset and contentLength in file bytes
DrawingSnapshot title, width, height, firstViewId, contentOffset and contentLength
GuidMapper pairs
TrimBim objectGuids (count in the stored source object GUID vector), importMetadata (stored importer entries, when present)
IdRanges next, ranges
History pageSize, pageCount, length
Dbv name, records (GUID records), sections, rows (the sum over all sections)
Nc1 blocks (the block codes in order), mark, material, quantity, profile, length
Template encoding, rootKeyword, instance, type, version (the values of the root properties of these names), blocks (the number of blocks below the root), maxDepth (the deepest block level; the root is level 0)
Report encoding, lines, pages (the number of form feeds), endsWithLineBreak
ObjectGroup encoding, version, rules and enabledRules (saved rule counts)
ObjectRepresentation encoding, version and rules (saved row count)

For a model database info also reads the text sections, so a malformed text section makes it fail with exit code 2. It reads the table sections to count the drawings. When it cannot (the tables cannot be read, the drawing table has rows of another size, or a text value of a drawing does not decode), it leaves drawings out and adds a warning that says why; like other warnings, it does not change the exit code.

Example, on a synthetic DSTV NC file:

$ tdbio info part.nc1
kind: Nc1
blocks: ST,AK,EN
mark: A1
material: GRADE-X
quantity: 3
profile: PL12
length: 100
warnings: 0
$ tdbio info part.nc1 --json
{
  "kind": "Nc1",
  "blocks": [
    "ST",
    "AK",
    "EN"
  ],
  "mark": "A1",
  "material": "GRADE-X",
  "quantity": 3,
  "profile": "PL12",
  "length": 100,
  "warnings": []
}

With --encoding, encoding shows the web name of the encoding used, for example windows-1252 for cp1252.

tables

Columns, separated by tabs:

Column Value
ordinal The position of the section in the file, from 0.
offset Where the section starts (the key when there is one, otherwise the separator), hex.
key The raw key stored before the section, or -. Always - for DBV@ files.
rowSize The number of body bytes in every row.
descriptors The raw descriptor words, separated by commas.
rows The number of rows.
end The offset just after the section, hex.

Offsets refer to the unpacked file. Row bodies are never printed.

$ tdbio tables model.db1
ordinal	offset	key	rowSize	descriptors	rows	end
0	0x7D	-	8	1,0	2	0xB4
1	0xB4	42	4	1	1	0xDA

With --json the object has kind, sections (one object per section with the column names as properties; offsets are decimal numbers, key is null when absent and descriptors is an array) and warnings.

text

Columns, separated by tabs:

Column Value
section The index of the text section, from 0.
headId The id of the head row of the chain.
rows The number of rows in the chain.
length The number of text bytes.
stamp true for a save stamp, else false.
savedAt The date and time of a save stamp, yyyy-MM-ddTHH:mm:ss, or -.
text The text bytes, escaped: printable ASCII as is, \\, \t, \n, and \xNN for every other byte. - for a save stamp.

The text of a save stamp is never printed: besides the date it can name people or machines. Rows that belong to no chain follow the chains, one line each: the section index, -, orphan and the row id.

$ tdbio text model.db1
section	headId	rows	length	stamp	savedAt	text
0	1	1	6	false	-	Grid A
0	10	2	42	true	2026-02-01T10:20:30	-

With --json the object has kind, chains (one object per chain with the column names as properties; savedAt and text are null when absent), orphans (objects with section and id) and warnings.

JSON output

Numbers are decimal, GUIDs use the D format (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) and dates the format yyyy-MM-ddTHH:mm:ss. The input path is never written. Warnings are both in the warnings array and on standard error.

Text output

Each value fits on one line: control characters in text taken from a file are written as \xNN. Lists are joined with commas. Numbers use the invariant culture.

All examples on this page come from small synthetic files; the values are made up.