SchemeExt:Component:parent

From DocR23

Jump to: navigation, search

Contents

Action

Returns the parent component for the specified component.

Filename

scm/scmext/kern/asm_scm.cpp

APIs

asmi_component_get_parent

Syntax

(component:parent comp [opts])

Argument Types

Argument Scheme Data Type
comp component
opts acis-options

Returns

component

Description

This extension returns the parent component of a specified component.

Arguments

  • comp specifies the component to be queried.
  • opts contains journaling and versioning information.

Example

; component:parent
; Create a model in the active part.
(define part_model (model:create))
;; part_model
(solid:block 0 0 0 10 10 10)
;; #[entity 1 1]
; Make a new part and set it active.
(define subasm_part (part:new))
;; subasm_part
(env:set-active-part subasm_part)
;; ()
; Create a model containing an assembly.
(define subasm_model (model:create))
;; subasm_model
(model:create-assembly)
;; ()
; Create the transform to be used on part_model.
(define part_transf (transform:translation (gvector 1 0 0)))
;; part_transf
; Create a model reference for part_model within the assembly.
(define part_model_ref (model:add-model-ref part_model part_transf))
;; part_model_ref
; Make a new part and set it active.
(define asm_part (part:new))
;; asm_part
(env:set-active-part asm_part)
;; ()
; Create a model containing an assembly.
(define asm_model (model:create))
;; asm_model
(model:create-assembly)
;; ()
; Create the transform to be used on part_model.
(define subasm_transf (transform:translation (gvector 0 0 10)))
;; subasm_transf
; Create a model reference for subasm_model within the assembly.
(define subasm_model_ref (model:add-model-ref subasm_model subasm_transf))
;; subasm_model_ref
; Get the component of asm_model associated with the block.
(define comp (component (list subasm_model_ref part_model_ref)))
;; comp
; Get the parent component of comp.
(component:parent comp)
;; #[component 2 3]
Personal tools