ws-3d2/step: cad/step (ISO 10303-21 read/write + injected B-rep plug-in)
- src/Formats/cad/step: Part 21 editions 1-3 parsed into Types.Cad fully in-library (header, named DATA sections,
complex instances, every parameter kind, string escapes to UTF-8, comments, ANCHOR/REFERENCE/SIGNATURE kept raw);
writer round-trips at the entity level (integral reals keep their real-ness via a list metatable mark).
- B-rep plug-in: a small injected table { read, write, tessellate } (or brep-luau's { Step, StepBrep, StepWrite, Tess }
as is), taken from opts.brep / opts.plugins.brep; Step.toBodies / fromBodies / tessellate (-> Scene, z up, mm).
- Types.luau: StepEntity gains optional parts (complex instances) and section (edition 3); backward compatible.
- init.luau (api): withHooks also passes opts.plugins = F.plugins to decoders/encoders unless given; new facades
F.cad.toBodies / fromBodies / tessellate (pass F.plugins, pcall, Err-wrapped). Backward compatible.
- tests/cad/step.luau + tools/fixtures/step.py: OCCT (gmsh) generated and public STEP files, Python census, OCCT reads
our output back, brep-luau through a generated tests/gen/.luaurc alias (luau only), fuzz.
- tools/bench.luau: step parse / write lines.
This commit is contained in:
1 parent
646d18f056
commit
443a7e45cb
12 files changed
+2154
-2
No files matched your search
@@ -0,0 +1,27 @@
|
||||
-- tools/fixtures/_step_encode: run by tools/fixtures/step.py (luau CLI, repo root): decodes every STEP case with our
|
||||
-- reader and writes it back with our writer, printing "case_<i>.step\t<hex>" lines for OCCT (through gmsh) to read.
|
||||
local Step = require("@formats/cad/step")
|
||||
local Bytes = require("@formats/core/Bytes")
|
||||
local Cases = require("@tests/gen/step_cases")
|
||||
|
||||
local HEX = {}
|
||||
for i = 0, 255 do
|
||||
HEX[i] = string.format("%02x", i)
|
||||
end
|
||||
local function hex(s: string): string
|
||||
local out = table.create(#s)
|
||||
for i = 1, #s do
|
||||
out[i] = HEX[string.byte(s, i)]
|
||||
end
|
||||
return table.concat(out)
|
||||
end
|
||||
|
||||
for i, c in Cases do
|
||||
local cad, err = Step.decode(Bytes.reader(buffer.fromstring(c.data)))
|
||||
if cad then
|
||||
local out = assert(Step.encode(cad))
|
||||
print(string.format("case_%d.step\t%s", i, hex(buffer.tostring(out))))
|
||||
else
|
||||
print("skipped " .. c.name .. ": " .. tostring(err))
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user