Home

PART Class Reference
[Part Management]

Provides methods and data for grouping entities together as parts. More...

#include <part.hxx>

Inheritance diagram for PART:

Inheritance graph
[legend]
Collaboration diagram for PART:

Collaboration graph
[legend]

List of all members.

Public Member Functions

entity_id_t add (ENTITY *en)
 Adds an ENTITY to a PART and returns its ID.
virtual void add_entity (ENTITY *en, entity_id_t en_id)
 Adds an ENTITY to a PART.
HISTORY_STREAMattach_history_stream ()
 Attaches a history stream to the given PART.
virtual void clear ()
 Deletes all entities and all their history from this PART's history stream.
virtual unsigned long count () const
 Gets the number of entities in the PART.
virtual entity_id_t create_id (ENTITY *en)=0
 Creates an ID for an ENTITY.
virtual void debug (FILE *file)=0
 Writes debug information about a PART to standard output or to the specified file.
logical entity_history ()
 Returns whether the given entity has a history stream.
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.
entity_callback_listget_callbacks ()
 Returns a list of entity_callbacks for the part, which are invoked when the entities in the PART are affected.
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.
unsigned long get_flags () const
 Gets the PART flags.
history_id_t get_history_index (HISTORY_STREAM *hist)
 Gets the index for the history stream.
virtual int get_MaxNumberofHits ()
 Returns the maximum number of picks possible.
unsigned int get_part_id () const
 Gets the ID of this PART.
part_handle handle () const
 Gets the handle for this PART.
HISTORY_STREAMhistory_stream ()
 Returns a history stream for the given PART.
virtual logical is_empty () const
 Returns TRUE if a PART is currently empty; otherwise, it returns FALSE.
logical is_modified () const
 Returns TRUE if a PART has been modified since the last save; otherwise, it returns FALSE.
virtual outcome load (FileInterface *file, ENTITY_LIST &en_list, logical his_flag=0)
 Loads a PART from a FileInterface.
outcome load (const char *file, logical text_flag, ENTITY_LIST &en_list, logical his_flag=0)
 Loads a PART from the specified sat file.
virtual outcome load (FILE *file, logical text_flag, ENTITY_LIST &en_list, logical his_flag=0)
 Loads a PART from a file.
virtual ENTITYlookup (entity_id_t en_id)=0
 Look up a part by its id.
HISTORY_STREAMlookup_history (history_id_t id)
 Look up a history stream of a part by its id.
double MMToModel (double value) const
 Converts between millimeters to PART units.
double ModelToMM (double value) const
 Converts between PART units to millimeters.
 PART (logical add_to_array=TRUE)
 C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.
const char * part_name () const
 Returns the name of the PART.
const char * PartUnits () const
 Return the units used in the PART.
virtual logical remove (ENTITY *en)
 Removes an ENTITY from a PART.
entity_callback_listremove_callback (entity_callback *cb)
 Removes a list of entity_callbacks from the part.
void remove_history_stream ()
 Removes a history stream from a PART.
virtual logical remove_id (entity_id_t en_id)
 Removes an ENTITY from a PART.
virtual void remove_ids ()=0
 Removes IDs from all non-top level entities.
void replace_history_stream (HISTORY_STREAM *&hs)
 Replace the current history stream.
virtual outcome save (FileInterface *file, logical his_flag=0)
 Saves a PART to a file interface, with or without history.
outcome save (logical text_flag, logical his_flag=0)
 Saves a PART to a file whose name is based on the part's name.
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.
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.
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.
logical SaveScale () const
 Returns TRUE if the method saves the units scale with the PART; otherwise, this method returns FALSE.
entity_callback_listset_callback (entity_callback *cb)
 Invokes an entity_callback for the PART, which is invoked when the entities in the PART are affected.
void set_entity_history (logical onoff)
 Turns on or off flag stating whether ENTITY has a history stream.
void set_flags (unsigned long flag)
 Sets the PART flags.
void set_modified (logical mod)
 Returns TRUE if an ENTITY in the PART has been modified; otherwise, it returns FALSE.
void set_part_name (const char *file)
 Sets the name for the PART.
void SetPartUnits (const char *unitsName, logical scale_part=TRUE)
 Sets the units scale using a character string that represents the units to use.
void SetSaveScale (logical save)
 Determines whether the units scale is saved with the PART.
void SetUnitsScale (double scale, logical scale_part=TRUE)
 Sets the units scale for the PART.
void time_stamp_activate ()
 Turn on time stamp mechanism.
logical time_stamp_allow_update ()
 Returns whether the time stamp mechanism is active or not.
void time_stamp_deactivate ()
 Turn off time stamp mechanism.
double UnitsScale () const
 Gets the units scale for the PART.
virtual void update (ENTITY *en)
 Call this method when an entity has been updated somehow.
HISTORY_STREAMupdate_default_stream () const
 Make sure the default stream is the active part's stream when distributing.
virtual ~PART ()
 C++ destructor, deleting a PART.

Protected Member Functions

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

Protected Attributes

logical HasBeenModified
 The logical that determines whether a part has been modified.
logical m_bSaveScale
 This flag controls whether the units scale factor is saved with the PART.
logical m_lEntityHistory
 Roll back histories for some top-level entities which have attached ATTRIB_HISTORY.
int m_nNumEdges
 Number of edges.
int m_nNumFaces
 Number of faces.
int m_nNumTCoEdges
 Number of tolerant coedges.
int m_nNumVertices
 Number of vertices.
entity_callback_list m_pEntityCallbacks
 The list of entity callbacks.
HISTORY_STREAMm_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.
double m_unitsScale
 The model scale specifies the units in which the PART is stored.
entity_id_t NextAvailableId
 The next available entity ID.
unsigned long PartFlags
 The flags for the part.
part_handle ThePartHandle
 The part_handle.
char * ThePartName
 The name of the part.


Detailed Description

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,ID_ATTRIB, active_part,HISTORY_STREAM, HISTORY_STREAM_LIST

Constructor & Destructor Documentation

PART::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?

virtual PART::~PART (  )  [virtual]

C++ destructor, deleting a PART.

PART::PART ( const PART prt  )  [protected]

C++ constructor.



Parameters:
prt part.


Member Function Documentation

entity_id_t PART::add ( ENTITY en  ) 

Adds an ENTITY to a PART and returns its ID.



Parameters:
en entity.

virtual void PART::add_entity ( ENTITY en,
entity_id_t  en_id 
) [virtual]

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.

HISTORY_STREAM* PART::attach_history_stream (  ) 

Attaches a history stream to the given PART.

virtual void PART::clear (  )  [virtual]

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.)

virtual unsigned long PART::count (  )  const [virtual]

Gets the number of entities in the PART.

virtual entity_id_t PART::create_id ( ENTITY en  )  [pure virtual]

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.

virtual void PART::debug ( FILE *  file  )  [pure virtual]

Writes debug information about a PART to standard output or to the specified file.



Parameters:
file file name.

logical PART::entity_history (  )  [inline]

Returns whether the given entity has a history stream.

void PART::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.

entity_callback_list* PART::get_callbacks (  )  [inline]

Returns a list of entity_callbacks for the part, which are invoked when the entities in the PART are affected.

virtual void PART::get_entities ( ENTITY_LIST en_list,
entity_filter en_filter = NULL 
) const [pure virtual]

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.

unsigned long PART::get_flags (  )  const [inline]

Gets the PART flags.

history_id_t PART::get_history_index ( HISTORY_STREAM hist  )  [inline]

Gets the index for the history stream.



Parameters:
hist stream pointer.

virtual int PART::get_MaxNumberofHits (  )  [inline, virtual]

Returns the maximum number of picks possible.

unsigned int PART::get_part_id (  )  const [inline]

Gets the ID of this PART.

part_handle PART::handle (  )  const [inline]

Gets the handle for this PART.

HISTORY_STREAM* PART::history_stream (  )  [inline]

Returns a history stream for the given PART.

virtual logical PART::is_empty (  )  const [virtual]

Returns TRUE if a PART is currently empty; otherwise, it returns FALSE.

logical PART::is_modified (  )  const [inline]

Returns TRUE if a PART has been modified since the last save; otherwise, it returns FALSE.

virtual outcome PART::load ( FileInterface file,
ENTITY_LIST en_list,
logical  his_flag = 0 
) [virtual]

Loads a PART from a FileInterface.



Parameters:
file file Interface.
en_list entity list.
his_flag flag for history.

outcome PART::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.

virtual outcome PART::load ( FILE *  file,
logical  text_flag,
ENTITY_LIST en_list,
logical  his_flag = 0 
) [virtual]

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.

virtual ENTITY* PART::lookup ( entity_id_t  en_id  )  [pure virtual]

Look up a part by its id.



Parameters:
en_id entity ID.

HISTORY_STREAM* PART::lookup_history ( history_id_t  id  )  [inline]

Look up a history stream of a part by its id.



Parameters:
id history stream.

double PART::MMToModel ( double  value  )  const [inline]

Converts between millimeters to PART units.



Parameters:
value scale factor.

double PART::ModelToMM ( double  value  )  const [inline]

Converts between PART units to millimeters.



Parameters:
value scale factor.

const char* PART::part_name (  )  const [inline]

Returns the name of the PART.

const char* PART::PartUnits (  )  const

Return the units used in the PART.

virtual logical PART::remove ( ENTITY en  )  [virtual]

Removes an ENTITY from a PART.



Parameters:
en entity.

entity_callback_list* PART::remove_callback ( entity_callback cb  ) 

Removes a list of entity_callbacks from the part.



Parameters:
cb callback.

void PART::remove_history_stream (  ) 

Removes a history stream from a PART.

virtual logical PART::remove_id ( entity_id_t  en_id  )  [virtual]

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.

virtual void PART::remove_ids (  )  [pure virtual]

Removes IDs from all non-top level entities.

void PART::replace_history_stream ( HISTORY_STREAM *&  hs  ) 

Replace the current history stream.



Parameters:
hs history stream.

virtual outcome PART::save ( FileInterface file,
logical  his_flag = 0 
) [virtual]

Saves a PART to a file interface, with or without history.



Parameters:
file file interface.
his_flag with history if TRUE.

outcome PART::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.

outcome PART::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.

virtual outcome PART::save ( FILE *  file,
logical  text_flag,
logical  his_flag = 0,
logical  mainline_only = 0 
) [virtual]

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.

virtual outcome PART::save_selection ( const ENTITY_LIST en_list,
FileInterface file,
logical  save_scale,
logical  with_history = 0,
logical  mainline_only = FALSE 
) [virtual]

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.

logical PART::SaveScale (  )  const [inline]

Returns TRUE if the method saves the units scale with the PART; otherwise, this method returns FALSE.

entity_callback_list* PART::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.

void PART::set_entity_history ( logical  onoff  )  [inline]

Turns on or off flag stating whether ENTITY has a history stream.



Parameters:
onoff history flag.

void PART::set_flags ( unsigned long  flag  ) 

Sets the PART flags.



Parameters:
flag flags.

void PART::set_modified ( logical  mod  )  [inline]

Returns TRUE if an ENTITY in the PART has been modified; otherwise, it returns FALSE.



Parameters:
mod modified or not.

void PART::set_part_name ( const char *  file  ) 

Sets the name for the PART.



Parameters:
file name.

void PART::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?

void PART::SetSaveScale ( logical  save  )  [inline]

Determines whether the units scale is saved with the PART.



Parameters:
save save units?

void PART::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?

void PART::time_stamp_activate (  ) 

Turn on time stamp mechanism.

logical PART::time_stamp_allow_update (  )  [inline]

Returns whether the time stamp mechanism is active or not.

void PART::time_stamp_deactivate (  ) 

Turn off time stamp mechanism.

double PART::UnitsScale (  )  const [inline]

Gets the units scale for the PART.

virtual void PART::update ( ENTITY en  )  [virtual]

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.

HISTORY_STREAM* PART::update_default_stream (  )  const

Make sure the default stream is the active part's stream when distributing.


Member Data Documentation

logical PART::HasBeenModified [protected]

The logical that determines whether a part has been modified.

logical PART::m_bSaveScale [protected]

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.

logical PART::m_lEntityHistory [protected]

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.

int PART::m_nNumEdges [protected]

Number of edges.

int PART::m_nNumFaces [protected]

Number of faces.

int PART::m_nNumTCoEdges [protected]

Number of tolerant coedges.

int PART::m_nNumVertices [protected]

Number of vertices.

The list of entity callbacks.

This is a roll back history for all top-level entities in this part, unless they already have their own history attached using attributes.

double PART::m_unitsScale [protected]

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.

The next available entity ID.

unsigned long PART::PartFlags [protected]

The flags for the part.

part_handle PART::ThePartHandle [protected]

The part_handle.

char* PART::ThePartName [protected]

The name of the part.