Purpose:
|
Provides methods and data for grouping entities together as parts.
|
|
Derivation:
|
PART : -
|
|
Filename:
|
part/part/pmhusk/part.hxx
|
|
Description:
|
This class provides basic functions for working with parts.
|
|
References:
|
PART
|
entity_callback_list
|
|
by PART
|
ID_ATTRIB, active_part
|
|
KERN
|
HISTORY_STREAM, HISTORY_STREAM_LIST
|
|
Data:
|
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.
|
|
|
protected HISTORY_STREAM_LIST m_cHistoryStreams;
|
|
Roll back histories for some top-level entities which have attached
ATTRIB_HISTORY.
m_pHistoryStream goes in here as well as the first entry.
|
|
|
protected char* ThePartName;
|
|
The name of the part.
|
|
|
protected double m_unitsScale;
|
|
The model scale specifies the units in which the
PART is stored. It is a scale factor that is multiplied by length units in the
PART to get the size in millimeters.
|
|
|
protected entity_callback_list m_pEntityCallbacks;
|
|
The list of entity callbacks.
|
|
|
protected entity_id_t NextAvailableId;
|
|
The next available entity ID.
|
|
|
protected int m_nNumEdges;
|
|
Number of edges.
|
|
|
protected int m_nNumFaces;
|
|
Number of faces.
|
|
|
protected int m_nNumTCoEdges;
|
|
Number of tolerant coedges.
|
|
|
protected int m_nNumVertices;
|
|
Number of vertices.
|
|
|
protected logical HasBeenModified;
|
|
The
logical that determines whether a part has been modified.
|
|
|
protected logical m_bSaveScale;
|
|
This flag controls whether the units scale factor is saved with the
PART. If it is
TRUE, then a
UNITS_SCALEENTITY is written into the save file.
|
|
|
protected logical m_lEntityHistory;
|
|
This logical determines whether or not to attach a
history_stream attribute to entities when they are added to a part.
|
|
|
protected part_handle ThePartHandle;
|
|
The
part_handle.
|
|
|
protected unsigned long PartFlags;
|
|
The flags for the part.
|
|
Constructor:
|
public: PART::PART
(
|
|
|
logical add_to_array
|
// Add part to array?
|
|
|
|
= TRUE
|
|
|
);
|
|
|
C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments. Optionally, this adds it to the array.
|
|
|
|
|
|
|
protected: PART::PART
(
|
|
|
const PART&
|
// part
|
|
|
);
|
|
|
C++ constructor.
|
|
|
|
|
Destructor:
|
public: virtual PART::~PART
();
|
|
|
C++ destructor, deleting a
PART.
|
|
|
|
Methods:
|
public: entity_id_t PART::add
(
|
|
|
ENTITY*
|
// entity
|
|
|
);
|
|
|
Adds an
ENTITY to a
PART and returns its ID.
|
|
|
|
|
|
|
public: virtual void PART::add_entity
(
|
|
|
ENTITY*,
|
// entity
|
|
|
entity_id_t
|
// entity ID
|
|
|
);
|
|
|
Adds an
ENTITY to a
PART. 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.
|
|
|
|
|
|
|
public: HISTORY_STREAM*
|
|
|
PART::attach_history_stream ();
|
|
|
Attaches a history stream to the given
PART.
|
|
|
|
|
|
|
public: virtual void PART::clear
();
|
|
|
Clears a part by deleting all entities and roll back data.
|
|
|
|
|
|
|
public: virtual unsigned long PART::count
() const;
|
|
|
Gets the number of entities in the
PART.
|
|
|
|
|
|
|
public: virtual entity_id_t PART::create_id
(
|
|
|
ENTITY*
|
// entity
|
|
|
) = 0;
|
|
|
Creates an ID for an
ENTITY. 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.
|
|
|
|
|
|
|
public: virtual void PART::debug
(
|
|
|
FILE*
|
// file name
|
|
|
) = 0;
|
|
|
Writes debug information about a
PART to standard output or to the specified file.
|
|
|
|
|
|
|
public: logical PART::entity_history
();
|
|
|
Returns whether the given entity has a history stream.
|
|
|
|
|
|
|
public: void PART::execute_callbacks
(
|
|
|
entity_event_type,
|
// type of event
|
|
|
ENTITY*
|
// entity
|
|
|
);
|
|
|
Determines if there is an
entity_callback_list for the
PART and, if there is one, executes the callback on it.
|
|
|
|
|
|
|
public: entity_callback_list*
|
|
|
PART::get_callbacks ();
|
|
|
Returns a list of
entity_callbacks for the part, which are invoked when the entities in the
PART are affected.
|
|
|
|
|
|
|
public: virtual void PART::get_entities
(
|
|
|
ENTITY_LIST&,
|
// list of entities
|
|
|
entity_filter*
|
// entity filter
|
|
|
|
= NULL
|
|
|
) const = 0;
|
|
|
Gets a list of all top level entities in the
PART that pass the given filter.
|
|
|
|
|
|
|
public: unsigned long PART::get_flags
() const;
|
|
|
Gets the
PART flags.
|
|
|
|
|
|
|
public: history_id_t PART::get_history_index
(
|
|
|
HISTORY_STREAM* hist
|
// stream pointer
|
|
|
);
|
|
|
Gets the index for the history stream.
|
|
|
|
|
|
|
public: virtual int PART::get_MaxNumberofHits
();
|
|
|
Returns the maximum number of picks possible.
|
|
|
|
|
|
|
public: unsigned int PART::get_part_id
() const;
|
|
|
Gets the ID of this
PART.
|
|
|
|
|
|
|
public: part_handle PART::handle
() const;
|
|
|
Gets the handle for this
PART.
|
|
|
|
|
|
|
public: HISTORY_STREAM* PART::history_stream
();
|
|
|
Returns a history stream for the given
PART.
|
|
|
|
|
|
|
public: virtual logical PART::is_empty
() const;
|
|
|
Returns
TRUE if a
PART is currently empty; otherwise, it returns
FALSE.
|
|
|
|
|
|
|
public: logical PART::is_modified
() const;
|
|
|
Returns
TRUE if a
PART has been modified since the last save; otherwise, it returns
FALSE.
|
|
|
|
|
|
|
public: outcome PART::load
(
|
|
|
const char*,
|
// file name
|
|
|
logical,
|
// flag text
|
|
|
ENTITY_LIST&,
|
// entity list
|
|
|
logical
|
// flag for history
|
|
|
|
= FALSE
|
|
|
);
|
|
|
Loads a
PART from the specified
.sat file.
|
|
|
|
|
|
|
public: virtual outcome PART::load
(
|
|
|
FILE*,
|
// file pointer
|
|
|
logical,
|
// flag text
|
|
|
ENTITY_LIST&,
|
// entity list
|
|
|
logical
|
// flag for history
|
|
|
|
= FALSE
|
|
|
);
|
|
|
Loads a
PART from a file. This function uses the
ACIS functions
start_delta_state,
api_restore_entity_list,
api_restore_entity, and
note_delta_state in the part load.
|
|
|
|
|
|
|
public: virtual outcome PART::load
(
|
|
|
FileInterface*,
|
// File interface
|
|
|
ENTITY_LIST&,
|
// entity list
|
|
|
logical
|
// flag for history
|
|
|
|
= FALSE
|
|
|
);
|
|
|
Loads a
PART from a
FileInterface.
|
|
|
|
|
|
|
public: virtual ENTITY* PART::lookup
(
|
|
|
entity_id_t
|
// entity id
|
|
|
)= 0;
|
|
|
Look up a part by its id.
|
|
|
|
|
|
|
public: HISTORY_STREAM* PART::lookup_history
(
|
|
|
history_id_t id
|
// history stream
|
|
|
);
|
|
|
Look up a history stream of a part by its id.
|
|
|
|
|
|
|
public: double PART::MMToModel
(
|
|
|
double value
|
// scale factor
|
|
|
) const;
|
|
|
Converts between millimeters to
PART units.
|
|
|
|
|
|
|
public: double PART::ModelToMM
(
|
|
|
double value
|
// scale factor
|
|
|
) const;
|
|
|
Converts between
PART units to millimeters.
|
|
|
|
|
|
|
public: const char* PART::PartUnits
() const;
|
|
|
Return the units used in the
PART.
|
|
|
|
|
|
|
public: const char* PART::part_name
() const;
|
|
|
Returns the name of the
PART.
|
|
|
|
|
|
|
public: virtual logical PART::remove
(
|
|
|
ENTITY*
|
// entity
|
|
|
);
|
|
|
Removes an
ENTITY from a
PART.
|
|
|
|
|
|
|
public: entity_callback_list* PART::remove_callback
(
|
|
|
entity_callback* cb
|
// callback
|
|
|
);
|
|
|
Removes a list of
entity_callbacks from the part.
|
|
|
|
|
|
|
public: void PART::remove_history_stream
();
|
|
|
Removes a history stream from a
PART.
|
|
|
|
|
|
|
public: virtual logical PART::remove_id
(
|
|
|
entity_id_t
|
// entity ID
|
|
|
);
|
|
|
Removes an
ENTITY from a
PART. 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.
|
|
|
|
|
|
|
public: virtual void PART::remove_ids
() = 0;
|
|
|
Removes IDs from all non-top level entities.
|
|
|
|
|
|
|
public: void PART::replace_history_stream
(
|
|
|
HISTORY_STREAM*& hs
|
// history stream
|
|
|
);
|
|
|
Replace the current history stream.
|
|
|
|
|
|
|
public: outcome PART::save
(
|
|
|
const char*,
|
// filename
|
|
|
logical,
|
// text
|
|
|
logical
|
// with history
|
|
|
|
= FALSE
|
|
|
);
|
|
|
Saves a
PART to a file, given the filename as a character string.
|
|
|
|
|
|
|
public: outcome PART::save
(
|
|
|
logical,
|
// text
|
|
|
logical
|
// history
|
|
|
|
= FALSE
|
|
|
);
|
|
|
Saves a
PART to a file whose name is based on the part's name.
|
|
|
|
|
|
|
public: virtual outcome PART::save
(
|
|
|
FILE*,
|
// part file
|
|
|
logical,
|
// text
|
|
|
logical
|
// with history
|
|
|
|
= FALSE,
|
|
|
logical mainline_only
|
// main line flag
|
|
|
|
= 0
|
|
|
);
|
|
|
Saves a
PART to a file, given the file pointer.
|
|
|
|
|
|
|
public: virtual outcome PART::save
(
|
|
|
FileInterface*,
|
// file interface
|
|
|
logical
|
// with history if TRUE
|
|
|
|
= FALSE
|
|
|
);
|
|
|
Saves a
PART to a file interface, with or without history.
|
|
|
|
|
|
|
public: logical PART::SaveScale
() const;
|
|
|
Returns
TRUE if the method saves the units scale with the
PART; otherwise, this method returns
FALSE.
|
|
|
|
|
|
|
public: virtual outcome PART::save_selection
(
|
|
|
const ENTITY_LIST&,
|
// list of entities
|
|
|
FileInterface*,
|
// filename
|
|
|
logical save_scale,
|
// version
|
|
|
logical with_history
|
// save with or without
|
|
|
|
= 0,
|
// history
|
|
|
logical mainline_only
|
// main line flag
|
|
|
|
= FALSE
|
|
|
);
|
|
|
Save a list of
ENTITYs to a file using the context of this
PART. This can be used to save a selection to the clipboard. It is also using internally by the
PART save methods.
|
|
|
|
|
|
|
public: void PART::SetPartUnits
(
|
|
|
const char* unitsName,
|
// units scale to use
|
|
|
logical scale_part
|
// part is scaled?
|
|
|
|
= TRUE
|
|
|
);
|
|
|
Sets the units scale using a character string that represents the units to use.
|
|
|
|
|
|
|
public: void PART::SetSaveScale
(
|
|
|
logical save
|
// save units?
|
|
|
);
|
|
|
Determines whether the units scale is saved with the
PART.
|
|
|
|
|
|
|
public: void PART::SetUnitsScale
(
|
|
|
double scale,
|
// units scale to use
|
|
|
logical scale_part
|
// part is scaled?
|
|
|
|
= TRUE
|
|
|
);
|
|
|
Sets the units scale for the
PART. 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.
|
|
|
|
|
|
|
public: entity_callback_list* PART::set_callback
(
|
|
|
entity_callback* cb
|
// entity callback
|
|
|
);
|
|
|
Invokes an
entity_callback for the
PART, which is invoked when the entities in the
PART are affected.
|
|
|
|
|
|
|
public: void PART::set_entity_history
(
|
|
|
logical onoff
|
// history flag
|
|
|
);
|
|
|
Turns on or off flag stating whether
ENTITY has a history stream.
|
|
|
|
|
|
|
public: void PART::set_flags
(
|
|
|
unsigned long
|
// flags
|
|
|
);
|
|
|
Sets the
PART flags.
|
|
|
|
|
|
|
public: void PART::set_modified
(
|
|
|
logical mod
|
// modified or not
|
|
|
);
|
|
|
Returns
TRUE if an
ENTITY in the
PART has been modified; otherwise, it returns
FALSE.
|
|
|
|
|
|
|
public: void PART::set_part_name
(
|
|
|
const char*
|
// name
|
|
|
);
|
|
|
Sets the name for the
PART.
|
|
|
|
|
|
|
public: double PART::UnitsScale
() const;
|
|
|
Gets the units scale for the
PART.
|
|
|
|
|
|
|
public: virtual void PART::update
(
|
|
|
ENTITY*
|
// entity
|
|
|
);
|
|
|
Call this method when an entity has been updated somehow. 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.
|
|
|
|
|
|
|
public: HISTORY_STREAM*
|
|
|
PART::update_default_stream () const;
|
|
|
Make sure the default stream is the active part's stream when distributing.
|
|
|
|
|
Related Fncs:
|
count_parts, find_part, get_next_part, get_part
|