All Frameworks  Class Hierarchy  This Framework  Previous  Next  Indexes

SPApart Class PART

SPAbase.ACIS_OBJECT
  |
  +---PART
 

Usage: you can derive this class.


public class PART

Provides methods and data for grouping entities together as parts.

Role: This class provides basic functions for working with parts.

See also:
entity_callback_list


Constructor and Destructor Index


o PART(PART&)
C++ constructor.
o PART(logical)
C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.
o ~PART()
C++ destructor, deleting a PART.

Method Index


o MMToModel(double)
Converts between millimeters to PART units.
o ModelToMM(double)
Converts between PART units to millimeters.
o PartUnits()
Return the units used in the PART.
o SaveScale()
Returns TRUE if the method saves the units scale with the PART; otherwise, this method returns FALSE.
o SetPartUnits(char*,logical)
Sets the units scale using a character string that represents the units to use.
o SetSaveScale(logical)
Determines whether the units scale is saved with the PART.
o SetUnitsScale(double,logical)
Sets the units scale for the PART.
o UnitsScale()
Gets the units scale for the PART.
o add(ENTITY*)
Adds an ENTITY to a PART and returns its ID.
o add_entity(ENTITY*,entity_id_t)
Adds an ENTITY to a PART.
o attach_history_stream()
Attaches a history stream to the given PART.
o clear()
Deletes all entities and all their history from this PART's history stream.
o count()
Gets the number of entities in the PART.
o create_id(ENTITY*)
Creates an ID for an ENTITY.
o debug(FILE*)
Writes debug information about a PART to standard output or to the specified file.
o entity_history()
Returns whether the given entity has a history stream.
o execute_callbacks(entity_event_type,ENTITY*)
Determines if there is an entity_callback_list for the PART and, if there is one, executes the callback on it.
o get_MaxNumberofHits()
Returns the maximum number of picks possible.
o get_callbacks()
Returns a list of entity_callbacks for the part, which are invoked when the entities in the PART are affected.
o get_entities(ENTITY_LIST&,entity_filter*)
Gets a list of all top level entities in the PART that pass the given filter.
o get_flags()
Gets the PART flags.
o get_history_index(HISTORY_STREAM*)
Gets the index for the history stream.
o get_part_id()
Gets the ID of this PART.
o handle()
Gets the handle for this PART.
o history_stream()
Returns a history stream for the given PART.
o is_empty()
Returns TRUE if a PART is currently empty; otherwise, it returns FALSE.
o is_modified()
Returns TRUE if a PART has been modified since the last save; otherwise, it returns FALSE.
o load(FILE*,logical,ENTITY_LIST&,logical)
Loads a PART from a file.
o load(FileInterface*,ENTITY_LIST&,logical)
Loads a PART from a FileInterface.
o load(char*,logical,ENTITY_LIST&,logical)
Loads a PART from the specified sat file.
o lookup(entity_id_t)
Look up a part by its id.
o lookup_history(history_id_t)
Look up a history stream of a part by its id.
o part_name()
Returns the name of the PART.
o remove(ENTITY*)
Removes an ENTITY from a PART.
o remove_callback(entity_callback*)
Removes a list of entity_callbacks from the part.
o remove_history_stream()
Removes a history stream from a PART.
o remove_id(entity_id_t)
Removes an ENTITY from a PART.
o remove_ids()
Removes IDs from all non-top level entities.
o replace_history_stream(HISTORY_STREAM*&)
Replace the current history stream.
o save(FILE*,logical,logical,logical)
Saves a PART to a file, given the file pointer.
o save(FileInterface*,logical)
Saves a PART to a file interface, with or without history.
o save(char*,logical,logical)
Saves a PART to a file, given the filename as a character string.
o save(logical,logical)
Saves a PART to a file whose name is based on the part's name.
o save_selection(ENTITY_LIST&,FileInterface*,logical,logical,logical)
Save a list of ENTITYs to a file using the context of this PART.
o set_callback(entity_callback*)
Invokes an entity_callback for the PART, which is invoked when the entities in the PART are affected.
o set_entity_history(logical)
Turns on or off flag stating whether ENTITY has a history stream.
o set_flags(unsigned long)
Sets the PART flags.
o set_modified(logical)
Returns TRUE if an ENTITY in the PART has been modified; otherwise, it returns FALSE.
o set_part_name(char*)
Sets the name for the PART.
o time_stamp_activate()
Turn on time stamp mechanism.
o time_stamp_allow_update()
Returns whether the time stamp mechanism is active or not.
o time_stamp_deactivate()
Turn off time stamp mechanism.
o update(ENTITY*)
Call this method when an entity has been updated somehow.
o update_default_stream()
Make sure the default stream is the active part's stream when distributing.

Data Member Index


o HasBeenModified
The logical that determines whether a part has been modified.
o NextAvailableId
The next available entity ID.
o PartFlags
The flags for the part.
o ThePartHandle
The part_handle.
o ThePartName
The name of the part.
o m_bSaveScale
This flag controls whether the units scale factor is saved with the PART.
o m_lEntityHistory
Roll back histories for some top-level entities which have attached ATTRIB_HISTORY.
o m_nNumEdges
Number of edges.
o m_nNumFaces
Number of faces.
o m_nNumTCoEdges
Number of tolerant coedges.
o m_nNumVertices
Number of vertices.
o m_pEntityCallbacks
The list of entity callbacks.
o m_pHistoryStream
This is a roll back history for all top-level entities in this part, unless they already have their own history attached using attributes.
o m_unitsScale
The model scale specifies the units in which the PART is stored.

Constructor and Destructor


o PART
protected PART( const PART& prt)
C++ constructor.

Parameters:
prt
part.
o PART
public PART(logical add_to_array= TRUE)
C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.

Role: Optionally, this adds it to the array.

Parameters:
add_to_array
Add part to array?
o ~PART
public virtual ~PART()
C++ destructor, deleting a PART.

Methods


o MMToModel
public double MMToModel(double value)
Converts between millimeters to PART units.

Parameters:
value
scale factor.
o ModelToMM
public double ModelToMM(double value)
Converts between PART units to millimeters.

Parameters:
value
scale factor.
o PartUnits
public const char* PartUnits()const
Return the units used in the PART.
o SaveScale
public logical SaveScale()
Returns TRUE if the method saves the units scale with the PART; otherwise, this method returns FALSE.
o SetPartUnits
public void SetPartUnits( const char* unitsName,
logical scale_part= TRUE)
Sets the units scale using a character string that represents the units to use.

Parameters:
unitsName
units scale to use.
scale_part
part is scaled?
o SetSaveScale
public void SetSaveScale(logical save)
Determines whether the units scale is saved with the PART.

Parameters:
save
save units?
o SetUnitsScale
public void SetUnitsScale(double scale,
logical scale_part= TRUE)
Sets the units scale for the PART.

Role: Setting the units scale for a PART does not change the data; it changes how that data is interpreted. When the units scale is changed, the use may also want to scale all the entities in the PART so that they remain the same size.

Parameters:
scale
units scale to use.
scale_part
part is scaled?
o UnitsScale
public double UnitsScale()
Gets the units scale for the PART.
o add
public entity_id_t add(ENTITY* en)
Adds an ENTITY to a PART and returns its ID.

Parameters:
en
entity.
o add_entity
public virtual void add_entity(ENTITY* en,
entity_id_t en_id)
Adds an ENTITY to a PART.

Role: Use this virtual form of add when an ID_ATTRIB already exists so that the ENTITY already has an ID. Call this only from the non-virtual add function, and from functions of ID_ATTRIB when adding entities back into a PART after a roll operation.

Parameters:
en
entity.
en_id
entity ID.
o attach_history_stream
public HISTORY_STREAM* attach_history_stream()
Attaches a history stream to the given PART.
o clear
public virtual void clear()
Deletes all entities and all their history from this PART's history stream. (Note that if distributed history is not enabled and multiple PARTs are sharing the same history stream, this call will delete all entities and all their histories from all PARTs sharing the same history stream.)
o count
public virtual unsigned long count()const
Gets the number of entities in the PART.
o create_id
public virtual entity_id_t create_id(ENTITY* en) = 0
Creates an ID for an ENTITY.

Role: This function provides an ID for an ENTITY that belongs to another ENTITY that is already in the PART. For example, call it to get an ID for an EDGE of a solid that is in the PART. If the owner of the ENTITY is not already in the PART, it is added to the PART.

Parameters:
en
entity.
o debug
public virtual void debug(FILE* file) = 0
Writes debug information about a PART to standard output or to the specified file.

Parameters:
file
file name.
o entity_history
public logical entity_history()
Returns whether the given entity has a history stream.
o execute_callbacks
public void execute_callbacks(entity_event_type en_event,
ENTITY* en)
Determines if there is an entity_callback_list for the PART and, if there is one, executes the callback on it.

Parameters:
en_event
type of event.
en
entity.
o get_MaxNumberofHits
public virtual int get_MaxNumberofHits()
Returns the maximum number of picks possible.
o get_callbacks
public entity_callback_list* get_callbacks()
Returns a list of entity_callbacks for the part, which are invoked when the entities in the PART are affected.
o get_entities
public virtual void get_entities(ENTITY_LIST& en_list,
entity_filter* en_filter= NULL) const = 0
Gets a list of all top level entities in the PART that pass the given filter.

Parameters:
en_list
list of entities.
en_filter
entity filter.
o get_flags
public unsigned long get_flags()
Gets the PART flags.
o get_history_index
public history_id_t get_history_index(HISTORY_STREAM* hist)
Gets the index for the history stream.

Parameters:
hist
stream pointer.
o get_part_id
public unsigned int get_part_id()
Gets the ID of this PART.
o handle
public part_handle handle()
Gets the handle for this PART.
o history_stream
public HISTORY_STREAM* history_stream()
Returns a history stream for the given PART.
o is_empty
public virtual logical is_empty()const
Returns TRUE if a PART is currently empty; otherwise, it returns FALSE.
o is_modified
public logical is_modified()
Returns TRUE if a PART has been modified since the last save; otherwise, it returns FALSE.
o load
public virtual outcome load(FILE* file,
logical text_flag,
ENTITY_LIST& en_list,
logical his_flag= 0)
Loads a PART from a file.

Role: This function uses the ACIS functions start_delta_state, api_restore_entity_list, api_restore_entity, and note_delta_state in the part load.

Parameters:
file
file pointer.
text_flag
flag text.
en_list
entity list.
his_flag
flag for history.
o load
public virtual outcome load(FileInterface* file,
ENTITY_LIST& en_list,
logical his_flag= 0)
Loads a PART from a FileInterface.

Parameters:
file
file Interface.
en_list
entity list.
his_flag
flag for history.
o load
public outcome load( const char* file,
logical text_flag,
ENTITY_LIST& en_list,
logical his_flag= 0)
Loads a PART from the specified sat file.

Parameters:
file
file name.
text_flag
flag text.
en_list
entity list.
his_flag
flag for history.
o lookup
public virtual ENTITY* lookup(entity_id_t en_id) = 0
Look up a part by its id.

Parameters:
en_id
entity ID.
o lookup_history
public HISTORY_STREAM* lookup_history(history_id_t id)
Look up a history stream of a part by its id.

Parameters:
id
history stream.
o part_name
public const char* part_name()
Returns the name of the PART.
o remove
public virtual logical remove(ENTITY* en)
Removes an ENTITY from a PART.

Parameters:
en
entity.
o remove_callback
public entity_callback_list* remove_callback(entity_callback* cb)
Removes a list of entity_callbacks from the part.

Parameters:
cb
callback.
o remove_history_stream
public void remove_history_stream()
Removes a history stream from a PART.
o remove_id
public virtual logical remove_id(entity_id_t en_id)
Removes an ENTITY from a PART.

Role:This version assumes that the ID_ATTRIB has already been lost, so it cleans up anything that is needed to remove it from its tables. It should only be necessary to implement the second form in a derived class.

Parameters:
en_id
entity ID.
o remove_ids
public virtual void remove_ids()= 0
Removes IDs from all non-top level entities.
o replace_history_stream
public void replace_history_stream(HISTORY_STREAM*& hs)
Replace the current history stream.

Parameters:
hs
history stream.
o save
public virtual outcome save(FILE* file,
logical text_flag,
logical his_flag= 0,
logical mainline_only=0)
Saves a PART to a file, given the file pointer.

Parameters:
file
part file.
text_flag
text.
his_flag
with history.
mainline_only
main line flag.
o save
public virtual outcome save(FileInterface* file,
logical his_flag= 0)
Saves a PART to a file interface, with or without history.

Parameters:
file
file interface.
his_flag
with history if TRUE.
o save
public outcome save( const char* file,
logical text_flag,
logical his_flag= 0)
Saves a PART to a file, given the filename as a character string.

Parameters:
file
filename.
text_flag
text.
his_flag
with history.
o save
public outcome save(logical text_flag,
logical his_flag= 0)
Saves a PART to a file whose name is based on the part's name.

Parameters:
text_flag
text.
his_flag
history.
o save_selection
public virtual outcome save_selection( const ENTITY_LIST& en_list,
FileInterface* file,
logical save_scale,
logical with_history= 0,
logical mainline_only= FALSE)
Save a list of ENTITYs to a file using the context of this PART.

Role: This can be used to save a selection to the clipboard. It is also using internally by the PART save methods.

Parameters:
en_list
list of entities.
file
filename.
save_scale
version.
with_history
save with or without history.
l
mainline_only main line flag.
o set_callback
public entity_callback_list* set_callback(entity_callback* cb)
Invokes an entity_callback for the PART, which is invoked when the entities in the PART are affected.

Parameters:
cb
entity callback.
o set_entity_history
public void set_entity_history(logical onoff)
Turns on or off flag stating whether ENTITY has a history stream.

Parameters:
onoff
history flag.
o set_flags
public void set_flags(unsigned long flag)
Sets the PART flags.

Parameters:
flag
flags.
o set_modified
public void set_modified(logical mod)
Returns TRUE if an ENTITY in the PART has been modified; otherwise, it returns FALSE.

Parameters:
mod
modified or not.
o set_part_name
public void set_part_name( const char* file)
Sets the name for the PART.

Parameters:
file
name.
o time_stamp_activate
public void time_stamp_activate()
Turn on time stamp mechanism.
o time_stamp_allow_update
public logical time_stamp_allow_update()
Returns whether the time stamp mechanism is active or not.
o time_stamp_deactivate
public void time_stamp_deactivate()
Turn off time stamp mechanism.
o update
public virtual void update(ENTITY* en)
Call this method when an entity has been updated somehow.

Role: The part itself doesn't really care, but this will trigger the entity_callback mechanism with a pm_Update_Entity so that observers will know that something interesting has occurred. During a later rollback, the entity_callback mechanism will be triggered with a pm_Roll_Update_Entity .

This does change the model and therefore starts a new DELTA_STATE if one is not already open. The reason for the model change is create a change bulletin on the ID_ATTRIB (and the DISPLAY_ATTRIB if using the GI too). This change bulletin is noticed during rollback and is used keep the PART (and display) in sync with the active state of the model.

The intended usage is for one to call PART::update after each change to the model. One should update inside the delta state where the changes occurred. That is, call PART::update and then api_part_note_state. There is no need to call PART::update after roll.

Parameters:
en
entity.
o update_default_stream
public HISTORY_STREAM* update_default_stream()const
Make sure the default stream is the active part's stream when distributing.

Data Members


o HasBeenModified
  protected logical HasBeenModified
The logical that determines whether a part has been modified.
o NextAvailableId
  protected entity_id_t NextAvailableId
The next available entity ID.
o PartFlags
  protected unsigned long PartFlags
The flags for the part.
o ThePartHandle
  protected part_handle ThePartHandle
The part_handle.
o ThePartName
  protected char* ThePartName
The name of the part.
o m_bSaveScale
  protected logical m_bSaveScale
This flag controls whether the units scale factor is saved with the PART.

Role: If it is TRUE, then a UNITS_SCALEENTITY is written into the save file.
o m_lEntityHistory
  protected logical m_lEntityHistory
Roll back histories for some top-level entities which have attached ATTRIB_HISTORY.

Role: m_pHistoryStream goes in here as well as the first entry.
o m_nNumEdges
  protected int m_nNumEdges
Number of edges.
o m_nNumFaces
  protected int m_nNumFaces
Number of faces.
o m_nNumTCoEdges
  protected int m_nNumTCoEdges
Number of tolerant coedges.
o m_nNumVertices
  protected int m_nNumVertices
Number of vertices.
o m_pEntityCallbacks
  protected entity_callback_list m_pEntityCallbacks
The list of entity callbacks.
o m_pHistoryStream
  protected HISTORY_STREAM* m_pHistoryStream
This is a roll back history for all top-level entities in this part, unless they already have their own history attached using attributes.
o m_unitsScale
  protected double m_unitsScale
The model scale specifies the units in which the PART is stored.

Role: It is a scale factor that is multiplied by length units in the PART to get the size in millimeters.

This object is included in the file: part.hxx

Copyright (c) 1989-2007 by Spatial Corp. All rights reserved.