# ShapeItems geometry implementation ## Implemented and deployed behavior This module projects a finite subset of the standard ShapeItems library into a display scene. It is **not full SysML/KerML conformance or full ShapeItems coverage**. 24 renderable types: - Curves: Line, Circle, Ellipse, Rectangle, Triangle, RightTriangle. - Planar surfaces: Disc, CircularDisc. - Curved surfaces: Sphere, Ellipsoid, Cylinder, EccentricCylinder, CircularCylinder, RightCircularCylinder, Cone, EccentricCone, CircularCone, RightCircularCone, Torus, RectangularToroid. - Polyhedral shapes: RectangularCuboid, RightTriangularPrism, RectangularPyramid, Tetrahedron. - Standard aliases: Box → RectangularCuboid; Wedge → RightTriangularPrism. A display boundary is drawn for surfaces and polyhedral shapes. This is not a CAD boundary representation or a volume mesh. Shapes are drawn in local coordinates with explicit conventions: X length, Y width, Z height; elliptical bases in XY; toroids revolve about Z. These coordinate conventions are application choices, not general spatial frame resolution. Upload multiple `.sysml` / `.kerml` files together, up to 30 files and 1.5 MB combined. The first file is editable; remaining files stay in memory as supporting sources. All are sent together when building geometry. Files are not saved by the server. Recognized geometry constructs include named packages/namespaces, part/item definitions, KerML classes, typed part/item/feature usages, single inheritance, nested usages and overrides. Only occurrences are rendered; definitions are templates. Qualified names resolve lexically; unqualified names may resolve by unique suffix. **Import visibility and full standard library linking are not evaluated.** Ambiguous names produce diagnostics. Scalar expressions support numeric constants, local attribute references, unary signs, +, -, *, /, and bounded powers. Length literals support mm, cm, m, km, um, in and ft, optionally qualified with SI. The scene normalizes lengths to mm. Unitless shape dimensions are interpreted as mm. Arithmetic checks dimensions; unsupported expressions, functions, or unknown units fail that occurrence explicitly. This evaluator is intentionally separate from a full SysML expression interpreter. Use **Load shape gallery** for a working model. Select individual shapes to inspect exact normalized parameters and file/line provenance. Drag to rotate; use the wheel to zoom; keyboard arrow keys also rotate. Orthographic view buttons, wireframe, PNG export and scene JSON export are available. Gallery positions are artificial separation for inspection, **not resolved assembly placement**. ## Remaining work for full coverage - Official complete SysML v2/KerML parsing, symbol linking, import/export visibility, constraints, multiplicities, multiple specialization, binding/alias expressions and occurrence evaluation. - Arbitrary Polygon, Quadrilateral, Polyhedron, Path and Shell topology represented by edges, vertices, faces, bindings and mating relationships. - Unbounded Parabola, Hyperbola, Paraboloid and Hyperboloid visualization with an explicitly chosen clipping domain; abstract/generic types cannot imply unique finite geometry. - SpatialItems/SpatialFrames coordinate frame transformations, relative placement and mating constraints. - General constrained shape synthesis, CSG, CAD kernel integration and solid FEA meshing. Unsupported declarations and unresolved values are reported, and partial scenes retain diagnostics. A successful projection is not a language-conformance result. The Abaqus `.inp` export remains the earlier B31 cantilever mapping and does not export these surfaces as solid elements. ## Standards references Parameter names and shape classifications were checked against the Systems Modeling Community's ShapeItems library: https://github.com/Systems-Modeling/SysML-v2-Release/blob/master/sysml.library/Domain%20Libraries/Geometry/ShapeItems.sysml Spatial semantics reference: https://github.com/Systems-Modeling/SysML-v2-Release/blob/master/sysml.library/Domain%20Libraries/Geometry/SpatialItems.sysml ## Arbitrary topology and placement adapter The following explicit adapter is now implemented. These `sv2a…` attributes are **SV2A application conventions**, not fields defined by the OMG standard. They bridge ShapeItems types to actual coordinates/connectivity without pretending to evaluate arbitrary standard bindings or mating equations. - `sv2aVertices = ((0,0,0),(30 [mm],0,0),(0,20 [mm],0));` supplies XYZ coordinates. - `sv2aFaces = ((1,2,3),);` supplies ordered face loops using ONE-BASED vertex indices. Winding must be consistent for closed polyhedra. - `sv2aEdges = ((1,2),(2,3));` optionally supplies Path/PlanarCurve edges. Otherwise consecutive points are connected. - `sv2aTranslation = (10 [mm],0,0);` gives a local translation relative to its containing occurrence. - `sv2aRotation = (0 [deg],0 [deg],90 [deg]);` gives local Euler angles. Unitless angles are radians. The transform is T · Rz · Ry · Rx and child transforms compose with parent transforms. Explicit topology adapters are available for Polygon, Quadrilateral, PlanarSurface, Polyhedron, Cuboid, Pyramid, TriangularPrism, Shell, Path and PlanarCurve. Concave simple planar polygons use ear clipping. Holes, curved edges, and non-planar face loops are not supported: split surfaces into planar faces first. Validation includes finite coordinates, index bounds, face planarity and self-intersections, and edge incidence/orientation plus nonzero signed volume for closed shapes. It does not establish general CAD validity or rule out intersections between different faces or objects. Limits: 500 vertices per shape, 1000 connectivity entries, 5000 total connectivity indices, 80 displayed shapes. Use **Assembly · adapter placement** to see composed world coordinates or **Separated gallery** to inspect each local shape. The viewer does not infer mating relationships or solve placement constraints. ### Clipped unbounded geometry Parabola, Hyperbola, Paraboloid and Hyperboloid now render only when an explicit positive **clipping extent in mm** is entered. The extent is a display window, not a model boundary or finite solid. Open surface boundaries are not capped. The renderer uses these explicit display conventions: parabola y=x²/(4f); paraboloid z=(x²+y²)/(4f); hyperbola x=±a cosh(t), y=b sinh(t); hyperboloid of revolution r=a cosh(t), z=b sinh(t) for one sheet or r=a sinh(t), z=±b cosh(t) for two sheets. Hyperboloid requires `sv2aSheetCount = 1` or `2`. Hyperbola uses the standard library's spelling `tranverseAxis`; Hyperboloid uses `transverseAxis`. The supplied axes are used as semi-axis parameters in these formulas. Parameter ranges are truncated so all local coordinates lie within ±extent. This is a documented adapter visualization convention; no general implicit-surface solver is included. `examples/advanced.sysml` demonstrates a concave plate, closed tetrahedral mesh, spatial path, clipped parabola, clipped hyperboloid, and nested placement. It is available through **Load arbitrary geometry**. The earlier remaining-work list must now be read with these adapter capabilities in mind: explicit arbitrary mesh input, display clipping and explicit transform composition are implemented; automatic standard graph/binding interpretation, complete language conformance, general constrained geometry/CSG and solid FEA meshing remain unimplemented. ## Abaqus/CAE Python export Use **Generate Abaqus/CAE script .py** to export the current source project. The server resolves that source again and rejects scenes with diagnostics. The app supplies tessellated display meshes for geometry that has no native export path. A representation manifest is shown before download. Native paths cover Line, Rectangle, Triangle, RightTriangle, Circle, CircularDisc, Ellipse, Disc, RectangularCuboid, RightTriangularPrism, RightCircularCylinder, RightCircularCone, Sphere, Torus and RectangularToroid. Other shapes become explicitly identified orphan surface meshes or native polyline wires. Native sphere and toroid paths create solids; shape-to-analysis idealization still needs review. Run the downloaded script with `abaqus cae noGUI=sv2a_abaqus.py` or through File → Run Script in Abaqus/CAE. It creates a unique output directory containing model.cae and import_report.json. It does not assign made-up analysis properties, submit jobs, or emit a misleading solver-ready INP. Complete the model in CAE before writing its analysis input. See exports/README.md for details. Abaqus execution remains unverified here. ## Standard physical placement and SysML view selection (current) The explicit standard-library forms below are now supported under an occurrence's `attribute coordinateFrame { attribute transformation : TYPE { ... } }`. This supersedes earlier adapter-only positioning descriptions. - **CoordinateFramePlacement**: explicit `origin` and optional `basisDirections`. The three basis directions form the columns of the rotation matrix; an empty sequence means identity orientation. - **TranslationRotationSequence**: explicit named Translation/Rotation children referenced by an ordered `elements = (shift,turn,...)` sequence. Translation uses `translationVector`. Rotation uses `axisDirection`, `angle` and optional `isIntrinsic` (defaults true). Intrinsic operations compose on the right; an explicitly extrinsic rotation composes on the left about the reference origin. Sequence order is retained. - **AffineTransformationMatrix3d**: explicit sixteen row-major `elements`, or `rotationMatrix.elements` plus `translationVector.num`. Only rigid right-handed transforms are accepted; scale, shear and reflection are rejected because they cannot be represented by Abaqus instance rotation/translation. - **NullTransformation**: identity placement. Explicit values support scalar arithmetic, per-component units, vector quantity syntax `(x,y,z) [mm]`, and quantity blocks with `num` plus a supported measurement reference. Inline vector measurement references can specify three `mRefs`; values are normalized to mm. Rotation angle literals accept deg/rad. Unitless lengths are mm and unitless angles are radians under this app's input convention. Full quantity/frame library type checking is not implemented. World placement is `parentWorld × localPlacement`. Inherited coordinate-frame bodies can be redefined partially. A standard placement and SV2A placement on the same occurrence produce a diagnostic instead of being applied twice. Unknown/non-rigid placement, explicit external source-frame references and unsupported dynamic expressions fail explicitly; they are not silently interpreted as identity. A named `view` usage with explicit `expose` names can select geometry for viewing and CAE Python export. Literal occurrence paths and trailing `::*`/`::**` namespace exposures are supported as occurrence subtree selections. Aggregate occurrences show their contained geometry; this is the app's geometry rendering policy, not a complete standard view/filter evaluator. View definitions, renderings, filter expressions, wildcard selectors beyond these suffixes and abstract definition-to-instance expansion are not implemented. Selecting a descendant keeps all ancestor transforms, even when ancestors themselves are not exposed. The default is All occurrences. The assembly preview, scene JSON and CAE Python export share the same resolved world matrices. The export manifest and generated import report include those matrices, local matrices, placement source and selected view. Camera, isolated-shape recentering and separated-gallery offsets are inspection aids and never feed the exporter. The manual B31 input-deck mapping remains a separate profile at its defined beam coordinates. **Example:** `examples/positioned.sysml` contains a nested assembly using all three explicit placement forms plus assembly/shaft views. The shaft's expected world origin is `(80,40,20)` mm and its local tip `(0,0,60)` maps to world `(80,100,20)` mm. Selecting `shaftView` must keep those values. The corresponding self-contained CAE script is available at `/exports/positioned_abaqus.py`. Standards checked: MeasurementReferences.sysml (CoordinateFramePlacement, Translation/Rotation, TranslationRotationSequence, AffineTransformationMatrix3d) and Quantities.sysml (num and mRef), in the SysML-v2-Release Domain Libraries/Quantities and Units directory. Complete SysML/KerML conformance remains outside this implementation. ## Example views and placements Every packaged example now includes named views, and each loader selects its main view automatically. The corresponding downloadable CAE script is regenerated from that exact view: | Source | Main view | Other views | Placement | | --- | --- | --- | --- | | cantilever.sysml | CantileverStudy::beamView | — | Explicit identity placement, matching the separate B31 deck profile | | shapes.sysml | ShapeGallery::assemblyView | housingView; shaftAndSealView | Parent translation (200,100,0) mm and Z rotation 30 degrees, plus component placements | | all-finite-shapes.sysml | AllFiniteShapes::allShapesView | curvesView; surfaceAndSpatialView | Source-declared 6×4 grid, 180 mm spacing, explicit Z rotations | | advanced.sysml | ArbitraryGeometry::allGeometryView | meshView; conicView | Standard parent/child transforms; SV2A attributes only for arbitrary topology and sheet selection | | positioned.sysml | PositionedAssembly::assemblyView | shaftView | CoordinateFramePlacement, TranslationRotationSequence and rigid affine matrix example; spare occurrence excluded from the main view | The grid is a physical placement example encoded in SysML, rather than the viewer's separated-gallery layout. Switching to a subset view preserves world coordinates. The cantilever also previews as a rectangular shape; its direct B31 analysis export remains a separate beam idealization.