part:new
List of: Scheme Extensions
Subjects: Part Management
Contents: Scheme Support

Action: Creates a new part.

Filename: scm/scmext/part_scm.cxx

APIs: api_pm_create_part

Syntax: (part:new [size=1009])

Arg Types: size integer

Returns: part

Description: The optional size, which must be a prime number, specifies how large to make the table that stores the entities in the part. This number does not limit the maximum number of entities that can be stored, but if a part has many more than this number of defined entities, performance slows when the application looks up the entities from Scheme. If the number is much larger than the number of entities referenced from Scheme, then more memory is used than is actually needed.


The default size is DEFAULT_PART_SIZE, which is defined in the file pmhusk/part_utl.hxx (value is 1009).


This procedure is affected by two of the option:set arguments.


option:setentity_history when #t, causes history to be kept in a separate stream for each top-level entity in the part. The history streams are attached via an ATTRIB_HISTORY. ATTRIB_HISTORY also takes care of merging history streams when bodies are merged via Booleans and other operations. The default for entity_history is #f.


option:setentity_history when #f causes a single history stream to be used for the whole part, and history data for entities in the part goes to the default stream. This stream is distinct from the histories of all other parts.


The with-history option allows one to save entity-specific history. (That is, history attached to the entity via attribute.)

Example: ; part:new

; Define a new part

(define part1 (part:new))

;; part1

; Set the part as the active part in the environment.

(env:set-active-part part1)

;; ()
PDF/SCM/04SC.PDF
HTM/DATA/SCM/SCM/04SC/0085.HTM