Repository navigation
Releases
Releases · TNYCL/cadkit
v0.5.3
Added
- WASM
CadDocument.pickEntityBoundedcaps inspection metadata before copying
and JSON conversion, reports shortened previews, omits raw properties and
rejects exhausted output/work budgets. LegacypickEntityremains compatible
and now copies metadata only after selecting the winning entity. cadkit_dgn::check_structure(alsonative::structure, andcadkit::dgn::check_structure
through the facade) returns aStructureReportof a DGN V8 file without thewrite
feature: sibling trees that are ordered red-black trees and that have the writer's
top-down shape, unused directory slots outside the MS-CFB free form, the writer's slot
order, pages with a page number or population, records without a time and split
dictionary pages, with the stable warning codesdgn.cfb_tree_unordered,
dgn.cfb_tree_unbalanced,dgn.cfb_tree_shared(a sibling tree reaching entries another
storage's tree holds; analysed once, so the work stays proportional to the directory),
dgn.cfb_free_entry,dgn.record_time,dgn.dictionary_page_splitand
dgn.model_page_counter. CLI:cadkit check-dgn file.dgnprints it as JSON (exit 1 when
it has warnings). Not exposed in Python, WASM or C.cadkit_dgn::strip_seed_v8(facadecadkit::strip_dgn_seed) copies a single-model DGN V8
seed without the drawing content of its model and without the document properties that
name people or organisations, for use as the seed ofwrite_v8: graphic records and
their XAttributes go, so do by default the model's control records (model settings,
model-level tag sets, raster groups) and every property set stream, replaced by a
\u{5}SummaryInformationwith code page, application and times only and a
\u{5}DocumentSummaryInformationwith the code page only. The dictionary (levels, fonts,
colour table, tag sets, text styles, views, settings, cell definitions), units and
undecoded streams stay byte for byte; the file header and model times are normalised from
StripSeedOptions::timestamp_msand the container is built anew (storages carry that
time, the root entry its modification time only, as MS-CFB 2.6.1 requires), so no byte of
a removed stream stays in free space. The application name is written asVT_LPSTR, the
type MS-OLEPS 2.25.1 givesPIDSI_APPNAME(the observed files storeVT_LPWSTR; the
reader reads both).StripSeedOptions(keep_controls,keep_raster_template,
keep_cell_definitions,model_name,timestamp_ms,application; JSON with
defaults, unknown fields rejected) and the returnedStrippedSeed/StripSeedReport,
which counts what was removed and what remains that may identify the source (named
levels, tag sets, cell definitions, model name and description, kept controls, raster
file references, undecoded streams). The result is not anonymous: names in the kept tables remain and must
be reviewed. Equal input and options give equal bytes; stripping a result again changes
nothing. Bindings: CLIcadkit strip-seed in.dgn out.dgn [--keep-controls] [--keep-raster-template] [--drop-cell-definitions] [--model-name NAME] [--timestamp-ms MS] [--application NAME] [--report](refuses to overwrite its input, also through a symbolic
link or, on Unix, a hard link), Python
cadkit.strip_dgn_seed(seed, **options) -> (bytes, dict), WASM
stripDgnSeed(seed, options?, readOptions?) -> { seed, report }, C
cadkit_dgn_strip_seed(seed bytes viacadkit_bytes_free, report JSON via
cadkit_string_free) and C++cadkit::strip_dgn_seed. No stripped seed has been opened
in another application.Attribute::colorandAttribute::lineweight(optional, withwith_color/
with_lineweight): the attribute record's own symbology when it differs from the
owning entity's;Nonemeans the owner's. The DGN reader resolves a tag element's
color through the file color table (or the default palette) and its weight as it does
for entities, keepingdgn.color_index/dgn.weight; the SVG renderer draws a
displayed attribute in its own color; the DGN writer uses them when the attribute has
no explicitdgn.color_index/dgn.weight(the explicit index still wins; a typed
color must exist in the seed palette, as for entities);Document::explode_insertsand the
DXF writer's ATTRIB records use them too (ByBlockandNonetake the insert's). Both
fields are omitted from JSON when unset, soschema_versionstays 1 and older JSON reads
unchanged (#30).- DGN type 11 curves carry their end conditions as
dgn.curve_start_tangent/
dgn.curve_end_tangent(GDAL dgnlib's slope at the first and last fit points, not
normalised); the DXF writer emits them, normalised, as SPLINE groups 12/13 of fit-point
splines (#28).Entity::transformedkeeps them under a translation and positive uniform
scale only and drops them otherwise (they would describe the untransformed curve). cadkit_dgn::native::TagData::display_rotationinterprets the orientation doubles of
a tag element by its 3D flag, and reads the quaternions cadkit up to 0.5.2 wrote into 2D
tags as such.- Warning
dgn.complex_count: a complex chain or shape declared more components than it
stores and was closed by the next chain or shape header that is itself a component (the
pattern reported in #27). cadkit_dgn::palette::exact_index(the writer's palette match) andnearest_index(the
matchV8Seed::prepare_documentuses for off-palette colors).V8Seed::font_entries(the seed's font table in stored order, repeated names included)
andV8Seed::font_number(exact name, then trimmed ASCII case-insensitive; absent and
ambiguous names are distinctUnsupportederrors).dgn.text_length_source = "range"on DGN text whose length comes from its element range
(V7, and V8 as under Changed).dgn.level_weight_raw/dgn.level_style_rawon layers read from 240-byte level entries:
the two fields that presumably hold the level's weight (0x44) and style (0x40), kept
raw; they set no lineweight or linetype.- DGN acceptance kit:
cargo run -p cadkit --example interchange -- SEED [DIR]writes small
synthetic DGN V8 files into a public seed (repacked and stripped seed, every supported
geometry kind on new levels, justified, Turkish UTF-16 and windows-1254 and rotated text,
a tag set with displayed, rotated and hidden tags, a hidden element, a 2D document in a 3D
seed, large coordinates, a new raster attachment with a synthetic 1-bit TIFF beside it, a
chained write, ByLayer colour), each read back and compared, checked with
check_structureand opened withcfbin strict mode before it is written, plus
MANIFEST.jsonandREADME.md.docs/dgn/ACCEPTANCE.mdis the protocol for opening
them in another application; no external acceptance is claimed. The example replaces the
former three-file output (01-repacked.dgn,02-new-geometry.dgn,
03-moved-and-tagged.dgn);synthetic.gmlstays. docs/dgn/FORMAT_NOTES.md("Built-in blank seed") andtests/blank_seed_evidence.rs
record why cadkit ships no built-in blank seed:Dgn~HandDgn~Mhhold undecoded
fields whose values differ between the public writers.
Changed
- DGN flat ellipses and arcs (smaller semi-axis at most 1e-9 of the larger one) are read as
Line(the segment the sweep covers along the non-zero axis) orPoint(both axes
zero) instead ofEllipse { ratio: 0 }, which broke the documented(0, 1]range. The
element data stays indgn.degenerate_ellipse,dgn.primary_axis,
dgn.secondary_axis,dgn.center,dgn.start_angle,dgn.sweep_angleand
dgn.rotation/dgn.quaternion; the DGN writer writes such an entity back as a line
(#24). - DGN V8 graphic elements with property bit
0x0080are read withEntity::visible = false
instead oftrue, following the report in #25 that other readers do not draw them; the
raw word stays indgn.properties. In the corpora only TreeText's tags carry the bit, so
graphics are covered by synthetic records only. V7 elements are unchanged. Written tags
take their hidden bit fromAttribute::invisibleonly, so a displayed tag of a hidden
entity stays displayed in the file (SVG output skips it with its owner). - A complex chain or shape header that follows an unfinished chain or shape closes it
instead of becoming its component, so chains in cells no longer nest into each other when
a chain declares more components than it stores, the cause of the nesting reported in
#27 (the reporter's files were not available; every chain and shape of the corpora
declares exactly the components it stores; the pattern is reproduced synthetically). - The bytes of every DGN file
write_v8writes change: the first dword of the model header
stream prefix (Dgn~Mh) is the number of graphic and control pages the output holds with
records, the relation observed in 552 of 567 private and 3 of 3 public V8 files (it was
the seed's value); a page without records is its 16-byte header (no empty zlib stream).
write_v8andrepack_v8write unused directory slots in the MS-CFB 2.6.3 free form
(thecfbcrate's form had a name length of 2). Slot order and the page headers of
unchanged seed pages are unchanged. - The DGN writer gives a
ByLayerentity without its owndgn.color_indexthe layer's
dgn.color_index(0–255) before trying the layer color, as it does fordgn.weight.
Documents read from a file write the same bytes as before (their elements carry their own
index); a newByLayerentity on a colored level is written with that level's index
instead of 0, also into a seed whose palette lacks the layer's RGB. - DGN V8 layers read from 240-byte level entries (the only layout of the private corpus;
the three public V8 samples use 104-byte entries) carry the level color:
Layer.coloris the file palette color of the entry's color index (0x48), kept in t...
v0.5.2
Added
cadkit::to_svg_bounded,cadkit_core::svg::render_boundedand WASM
CadDocument.toSvgBoundedreject SVG output or work-budget exhaustion without
returning a partial drawing. The UTF-8 output cap covers XML, layer names,
definitions, intermediate SVG strings and final assembly. Existing SVG entry
points retain their truncation behavior.
v0.5.1
Documentation
- Present cadkit as a modular CAD engine, with a module map, document operations,
geometry/scene/rendering boundaries and clearer supported file input/output. - Align package descriptions and READMEs with the current APIs, document the scene bridge
and CPU handoff, and clarify 0.5 migration and the untested DWG R13 scope.
v0.5.0
0.5 is the deliberate breaking release that settles the API: later 0.5.x releases only add.
See "Migrating from 0.4" below.
Added
- Constructors and
with_*setters for every model and option type (Layer::new,
Block::new,Model::new,Linetype::new,TextStyle::new,Attribute::new,
AttributeDisplay::new,Warning::new,SourceInfo::new,Units::new,Limits::new,
WalkOptions::new,BBoxOptions::newandnew()on the reader/writer options). Document::schema_version(SchemaVersion, currently 1) in the document JSON, typed
Error::SchemaVersionfor other versions, and an optionalschemarsfeature on
cadkit-corewith the committed schemadocs/schema/document-v1.schema.json.LimitKindonError::LimitExceeded, naming theLimitsfield, a work or output budget,
or a format capacity overflow.cadkit_dgn::Symbologywith thedgn.level_id/dgn.color_index/dgn.weight/
dgn.stylekey constants, andV8Seed::palette,levels,fontsandtimestamp_ms.cadkit_gml::tkgm::Severityfor profile findings.- New
cadkit-scenecrate (GPU-free, WASM-compatible):Plan2d, a chunked 2D store of
lines, polylines, arcs and circles with documented GPU instance encoding, per-frame f32
error budget checks, overlay cut-outs and CPU fallback;Mesh3d/MeshScene/
MeshBudgetand the error-checkedrelative_positionsf64 to f32 conversion. - New
cadkit-gpucrate onwgpu30 (re-exported):PlanRendererforPlan2dframes
(analytic antialiased lines and arcs, mitred corners, hairline fading, premultiplied
blending, per-generation chunk uploads),MeshRendererwithOrbitCameraand
incremental mesh/camera updates,RenderTargetCache,render_texture,
render_offscreen,mesh_budget, typedGpuErrors and ablock_onhelper. CI runs
its rendering tests on Mesa lavapipe. cadkit-scenefeaturedocument:document::plan_documentturns the visible entities
of aDocumentmodel (blocks and arrays expanded) into plan items with resolved colors,
lineweight widths, layer groups and SVG-like contrast against the background; curves that
do not stay circular are flattened. ADocumentPlanReportcounts what is not drawn
(text, hatches, points, images, unknown records, dashes drawn solid).
cadkit-gpu/examples/render_png.rsrenders a DWG, DXF or DGN file to PNG with it.cadkit_core::svg::with_contrast, the stroke contrast rule of the SVG export.
Changed
- Breaking:
Document,SourceInfo,Units,Layer,Linetype,TextStyle,Block,
Model,Entity,Attribute,AttributeDisplay,Warning, the enumsEntityKind,
Value,Format,ModelKindandGroupKind, and the option structsLimits,
ReadOptions,SvgOptions,BBoxOptions,WalkOptions,cadkit_dgn::WriteOptions,
SeedPrepareOptions,cadkit_gml::ExportOptions,ImportOptions,ValidationOptions
andProfileIssueare#[non_exhaustive].Color,Lineweight,HatchEdge,
DimensionTypeandLengthUnitmirror closed sets of the formats and stay exhaustive. - Breaking:
Error::LimitExceeded(String)is nowError::LimitExceeded { limit, message };
the error text is unchanged. - Breaking:
ProfileIssue::severityis aSeverity; its JSON stays"error"/"review". - Document JSON written by this version starts with
"schema_version": 1. JSON without
the field still reads. - CI runs
cargo-semver-checks, so 0.5.x releases stay additive.
Migrating from 0.4
- Struct literals of the types above no longer compile outside cadkit. Use the
constructors and setters, or start fromDefault::default()/new()and assign fields:
Layer { name, color, ..Layer::default() }becomesLayer::new(name).with_color(color).
Layer::newmakes a visible, plottable layer;Layer::default()keeps every flagfalse.
TextStyle::newsets a width factor of 1. matchonEntityKind,Value,Format,ModelKindorGroupKindneeds a_arm.- Replace
Error::LimitExceeded(message)patterns withError::LimitExceeded { message, .. }. - Compare
ProfileIssue::severitywithSeverity::Error/Severity::Review
(orseverity.as_str()). - The C ABI, the Python and WASM APIs and the JSON of the options are unchanged.
v0.4.0
Added
- Independent
cadkit-geomcrate with analytic curves, polygon booleans and source
provenance, calibration, trim/offset, and certified NURBS evaluation,
tessellation and nearest-point search. - Optional
schemarsfeature, unconditional serde support, explicit numerical
budgets, English API documentation and synthetic extreme-input regressions.
Changed
- Raise the workspace MSRV from Rust 1.85 to 1.88 for the pinned
i_overlay9.0.0
geometry dependency. - Update existing workspace code to the lint spelling enabled by Rust 1.88
(let chains, fixed-size chunk iteration and divisibility checks), without
changing the format or binding contracts.
v0.3.7
Header inspection, CAD document operations and binding/CLI parity, with additional format
coverage and explicit export controls. Existing 0.3.x option-struct layouts are retained.
Added
- Header-only inspection and stream-oriented facade helpers, feature selection, and a prelude.
- Document transformations, unit conversion, block expansion, geometry utilities and reusable
DGN V8 seed preparation with explicit unit/dimension/symbology conversion. - Additional SVG hatch/dimension/linetype handling, binary DXF and CAD entity support,
CityGML curve/geometry handling, and legacy OEM code-page decoding/byte export. - Python inspection, reusable
V8Seed, immutable document operations and updated typing;
additive C/C++ entry points with immutable result handles and CMake/pkg-config installation. - CLI JSON summaries, bounded stdin/stdout conversion, output code pages, geometry filters
and shell completion scripts without extra Cargo dependencies. - WASM option/result types and object options, document operations and geometric picking;
viewer code-page, visibility, coordinate, selection and GML export controls.
Fixed
- GML shell diagnostics handle extreme finite coordinates without integer-overflow panics.
- Reader/export bounds, encoding, geometry and cross-format fidelity edge cases, backed by
synthetic regressions. Reader/export paths also avoid several temporary allocations. - Circular viewer picking uses analytic XY distance; display-hidden layers are excluded
from selection. GML export requires an explicit CRS and explicit metadata-only opt-in. - C ABI struct layouts and existing entry points remain unchanged; failed operations reset
outputs and immutable block expansion reports exhausted work limits instead of a partial copy.
Changed
- English repository documentation/public messages, contribution and security guidance,
issue/PR templates, deterministic fuzz seeding and release checks. - Expanded API and architecture documentation and C++ contract testing in CI.
v0.3.6
DGN CFB directory trees, page header counters, and default element timestamps match
MicroStation V8 output.
Fixed
write_v8orders the CFB directory withDgn~Hat slot 1,Dgn~Sat slot 2, and
Dgn-Mdat slot 3 (each storage before its child streams,^AHbefore$1in
Dgn^GA/Dgn^CA), and rebalances every storage's child sibling tree in place using
top-down 2-3-4 red-black insertion in directory slot order. Thecfbcrate wrote
storages first and left sibling trees as unbalanced all-black chains.- All DGN
$page streams (Dgn^G,Dgn^C,Dgn^GA,Dgn^CA,Dgn^Nm,Dgn^NmA)
write(page_number, population) == (0, 0)at bytes8..16of the 16-byte page header,
andDgn-Md/#000000/Dgn^CA/^AHis preserved whenpreserve_seed_controlsis enabled. - When
WriteOptions::timestamp_msis0.0,write_v8defaults element timestamps to
the seed'sDgn~Htimestamp at offset0x130.
v0.3.5
DGN dictionary pages keep the seed's layout, so a level table is no longer split across
pages.
Fixed
write_v8no longer joins the seed's dictionary records (Dgn^Nm) and re-splits them
into new 256 KiB pages. A level table split over two pages is not loaded as one table
by MicroStation: every element showed on "Default". Every seed page now keeps its
number and record order; a page whose records did not change keeps its stream byte for
byte (empty pages included), a changed page is rewritten in place, and new tables and
tag sets share one new page after the seed's last page. No table or complex element
crosses a page; onlymax_decompressed_bytesbounds a page (exceeding it is a
LimitExceedederror, nothing is split silently).- Dictionary and XAttribute page headers write page number and population 0, as on every
surveyed file. XAttribute records move with their elements. - A new level entry is appended to the level table's page with the seed entries' flags
and a fresh level code (+0x5C), instead of the first level's code. Seeds written by
earlier cadkit versions (split tables) are repaired on write. - The workspace builds with its declared MSRV (Rust 1.85) again: the DGN writer no
longer usesletchains (since 0.3.2).
v0.3.4
DGN raster attachments can name a file beside the DGN instead of a machine path.
Added
- A new raster attachment whose
pathis relative and names a file beside the DGN
stores no machine-specific location: a bare file name writes the name and an empty
full path,.\name(or./name) is stored as given. Absolute paths still write the
file://URL. Relative paths into other folders are rejected.
Fixed
- An empty raster full path or file name reads as absent: the image
pathfalls back to
the file name and no emptydgn.raster_pathis reported.
v0.3.3
DGN raster attachments can be written into seeds that hold none.
Added
- New raster attachments no longer need a seed attachment to clone: a seed without one
gets a built-in attachment group made of the bytes every surveyed attachment shares,
with a bitonal display (white foreground, black background) and 200 DPI unless
dgn.raster_dpiis set.seed_has_raster_templatestill tells whether the seed's own
group is used.