Add playground code and examples
This commit is contained in:
Executable
+1147
File diff suppressed because it is too large
Load Diff
Executable
+1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,23 @@
|
|||||||
|
import { readFileSync } from "fs";
|
||||||
|
import * as aasCore from "@aas-core-works/aas-core3.0-typescript";
|
||||||
|
|
||||||
|
const aasFile = readFileSync("../AID-AIMC-Full-Example-20230911T1608.json", {encoding: "utf-8"});
|
||||||
|
const aasJSON = JSON.parse(aasFile);
|
||||||
|
|
||||||
|
const env = aasCore.jsonization.environmentFromJsonable(aasJSON);
|
||||||
|
|
||||||
|
if (env.error || !env.value || !env.value.assetAdministrationShells || !env.value.submodels) throw new Error("Invalid AAS file");
|
||||||
|
|
||||||
|
const aas = env.value.assetAdministrationShells[0];
|
||||||
|
const submodels = env.value.submodels;
|
||||||
|
|
||||||
|
const aid = submodels[0].submodelElements
|
||||||
|
if (aid === null) throw new Error("Invalid AAS file");
|
||||||
|
|
||||||
|
console.log(((aid[0] as aasCore.types.SubmodelElementList).value as aasCore.types.SubmodelElementCollection[])[0])
|
||||||
|
|
||||||
|
/*
|
||||||
|
for (const something of aas.descend()) {
|
||||||
|
console.log(something);
|
||||||
|
console.log("---------------------------------------");
|
||||||
|
}*/
|
||||||
|
|||||||
Reference in New Issue
Block a user