GitHubGitHub Stars

Pure AP242 product structure — no geometry at all. products, product definitions and a NEXT_ASSEMBLY_USAGE_OCCURRENCE relate a housing to a bracket. Renders as a text-summary card, not a picture — this is what a geometry-free script looks like.

product-structure.kstep.kts
// product-structure.kstep.kts -- a two-part assembly (housing + mounting bracket) with no
// geometry at all: pure AP242 product structure (applicationContext/productContext/
// productDefinitionContext/product/productDefinition/productDefinitionFormation/
// nextAssemblyUsageOccurrence), the layer kSTEP started with before the OCCT geometry track
// existed. `kstep render` falls back to a text-summary card for a script like this one --
// there is nothing to shade, so the preview lists the model's Part 21 instances instead. That
// is expected, correct output, not a rendering failure -- see occt-box.kstep.kts and
// extrude-fillet.kstep.kts for the geometry-bearing examples in this same playground.
//
// Run: kstep render product-structure.kstep.kts -f svg -o product-structure.svg

val appCtx = applicationContext { application = "configuration control" }.getOrThrow()
val prodCtx =
    productContext {
        name = "engineering"
        frameOfReference = appCtx
        disciplineType = "mechanical"
    }.getOrThrow()
val defCtx =
    productDefinitionContext {
        name = "engineering"
        frameOfReference = appCtx
        lifeCycleStage = "design"
    }.getOrThrow()

val housing =
    product("HSG-100") {
        name = "Housing"
        description = "Enclosure housing"
        frameOfReference = setOf(prodCtx)
    }.getOrThrow()
val housingFormation = productDefinitionFormation("HSG-100-F") { ofProduct = housing }.getOrThrow()
val housingDefinition =
    productDefinition("HSG-100-D") {
        formation = housingFormation
        frameOfReference = defCtx
    }.getOrThrow()

val bracket =
    product("BRK-100") {
        name = "Mounting Bracket"
        description = "L-shaped mounting bracket"
        frameOfReference = setOf(prodCtx)
    }.getOrThrow()
val bracketFormation = productDefinitionFormation("BRK-100-F") { ofProduct = bracket }.getOrThrow()
val bracketDefinition =
    productDefinition("BRK-100-D") {
        formation = bracketFormation
        frameOfReference = defCtx
    }.getOrThrow()

stepFile(fileName = "hello-assembly.step") {
    root(
        nextAssemblyUsageOccurrence("NAUO-100") {
            name = "housing to bracket"
            relatingProductDefinition = housingDefinition
            relatedProductDefinition = bracketDefinition
            referenceDesignator = "RD-1"
        },
    )
}
Rendered preview: Product Structure