.NET Framework Class Library
DataEntrHelper Members
|
<< Click to Display Table of Contents >> Navigation: Programming Mechworks PDM > .NET API > MwPDMApi Namespace > DataEntrHelper Class > .NET Framework Class Library |
The DataEntrHelper type exposes the following members.
Methods
|
Name |
Description |
|---|---|---|
|
Creates a cancellation file ("DataEntr_Custom.CANCEL") in the system temporary directory to signal that the Save As process should be cancelled. Typically called from custom DataEntr_PreEvent or DataEntr_PostEvent methods. |
|
|
Clears temporary data. |
|
|
Outputs default values to the MWPDM API after script execution. This method performs several actions to prepare and transmit script-generated data: •Validates that both the folder and file name are set; shows an error message if missing. •Writes the file name and folder path using DBWLib.DBWOutput, ensuring the path ends with a backslash. •Outputs part/assembly ID and description, if available. •If the part/assembly was copied, outputs the source UID and corresponding ID. •Outputs category values for all categorizable fields. •Clears unused category fields beyond the maximum allowed, unless called from the Assembly Duplication Wizard ("ADW"). •Outputs the current project name, if specified. •Outputs configuration property name when the context is ADD_CONFIGURATION or RENAME_CONFIGURATION. |
|
|
Equals |
(Inherited from Object.) |
|
(Overrides Object.Finalize().) |
|
|
Retrieves category data from an existing Part or Assembly identified by its UID. Populates the SelectedCategoriesArray with ObjCategory instances found in the linked fields and prepares the ValueFieldsLinkedToCategories for document output. |
|
|
Returns the current document's file extension, including the leading dot (e.g., ".sldprt"). |
|
|
Returns the current document type code (e.g., "A" for Assembly, "P" for Part, "D" for Drawing). The value identifies the type of CAD document being processed. |
|
|
Constructs a default description string by concatenating selected category names, excluding the first one in the list. This logic applies only when the method is not called from the Assembly Duplication Wizard (ADW), and when SelectedCategoriesArray contains more than one item. The resulting description is built by joining the remaining category names using the CM_Separator string. |
|
|
Retrieves the default description for a drawing based on the current context. The description is typically derived from the associated Part or Assembly if available. Specifically: •In contexts SAVE_AS, GET_FILENAME_BEFORE_SAVEAS, or SAVE_AS_LINKED_DRAWING: Retrieves the UID of the linked model and uses its description. •In context RENAME_DRAWING: No description is returned or modified. •In all other cases: Prompts the user to enter a name manually and returns an empty string. If called from the Assembly Duplication Wizard (ADW), no description is returned. |
|
|
Generates the default file name (including extension but excluding the directory path) based on the provided number and current context. The method considers various configuration flags and context: •Standard context: If category management is enabled (CM_USE_SUBCODES) and configured to prepend the first category, the category name is prefixed to the file name using CM_Separator. Otherwise, only the number and extension are used. •ADW (Assembly Duplication Wizard): Attempts to replace the original component ID in the file name with the new number. Falls back to appending the new number and extension if no match is found. •Configuration management: If active configurations are used, the method may override the file name with an existing one or retain the current configuration-specific name depending on whether the context is ADD_CONFIGURATION or SAVE_AS. |
|
|
Generates the default file name for a drawing based on the provided new number, current context, and optional conditions. Behavior by context: •ADW (Assembly Duplication Wizard): Constructs the file name using the new number and extension. Optionally, it may derive the name from the main component's file name, including a drawing index if ADWGetFileNameWithoutExt is enabled (currently commented). •SAVE_AS, GET_FILENAME_BEFORE_SAVEAS, SAVE_AS_LINKED_DRAWING: Returns the new number with the standard extension. •RENAME_DRAWING: Returns the new number with the extension. Optionally, the old component name in the current drawing file name may be replaced with the new component name if OnDrawingRenameUseComponentFileName is enabled (currently commented). •No linked document: Prompts the user to manually enter a name and outputs a blank ID. |
|
|
||
|
Determines and returns the default folder path for the drawing based on the execution context. The returned path always includes a trailing backslash (\). Folder resolution depends on the following contexts: •ADW (Assembly Duplication Wizard): Uses the folder of the new component file. •SAVE_AS / GET_FILENAME_BEFORE_SAVEAS / SAVE_AS_LINKED_DRAWING: Attempts to retrieve the model's folder via UID lookup. If unavailable, falls back to the original script folder. •RENAME_DRAWING: Retrieves the folder from the original part/assembly UID. •Fallback: If no valid document is found, prompts the user to enter a name manually and returns an empty string. |
|
|
Retrieves the full part or assembly number for a new model, based on the execution context and category settings. If not called from the Assembly Duplication Wizard (ADW), this method launches the Category Wizard and uses the selected categories to compute a default ID via GetDefaultID. If called from the duplication wizard: •If CheckIfInFiltering is enabled, writes dummy values for the ID and file name and exits. •Otherwise, retrieves the default ID based on the original file and selected category options. |
|
|
Generates the default number (ID) for a new or renamed drawing based on the current context and related component data. The returned number is determined by the execution context, such as: •ADW (Assembly Duplication Wizard): Uses NewComponentID, optionally appending a counter. •SAVE_AS, SAVE_AS_LINKED_DRAWING, GET_FILENAME_BEFORE_SAVEAS: Retrieves the associated component UID, checks existing drawings, and computes the next available drawing ID. •RENAME_DRAWING: Determines the new drawing name by analyzing the original and current IDs and parent relationships. If no valid drawing context is detected or an error occurs, an empty string is returned. |
|
|
Retrieves the default project name for the drawing based on script context. If the Category Wizard was shown, this returns the project selected by the user (choosed_project). Otherwise, it defaults to the project passed into the script via DBWInput("@CURRENT_PROJECT"). |
|
|
Retrieves the revision value of the model (Part or Assembly) linked to the current drawing. Return Value The revision string of the linked model, or an empty string if not available. |
|
|
Retrieves the first available revision value, based on the revisions configurations. Return Value The first revision string if found; otherwise, an empty string. |
|
|
GetHashCode |
(Inherited from Object.) |
|
Retrieves the UID of the Part or Assembly linked to the current drawing, based on the active save context. This method checks if the drawing is being processed in a Save As–related context (e.g., SAVE_AS, GET_FILENAME_BEFORE_SAVEAS, or SAVE_AS_LINKED_DRAWING). It then verifies the saved configuration and attempts to resolve the UID of the associated component. |
|
|
GetType |
(Inherited from Object.) |
|
Reads category-related values from a temporary file and populates internal data structures such as SelectedCategoriesArray and ValueFieldsLinkedToCategories. The input file (referenced by tempCategoriesFile) is parsed line-by-line for key-value pairs defining category metadata such as project name, category titles, codes, and descriptions.. The method also sets internal counters like CategoryMakerTreeDepth and _MaxCategorizable, and ensures that the internal category value fields arrays are properly aligned with the number of selected categories. Return Value True if valid category data was loaded and processed; False otherwise. |
|
|
Parses post-event output values and updates global variables accordingly. This method reads key-value pairs from the temporary DBWorks script output file and assigns values to fields such as NewNumber, NewFileName, NewFolderPath, NewDescription, NewProject, and NewRevision, based on recognized keys in the file. Lines starting with a semicolon (;) are treated as comments and ignored. |
|
|
Determines whether the specified file name is valid by checking for invalid characters. Returns True if the file name does not contain any of the following characters: \ / : * ? " < > |; otherwise, returns False. |
|
|
Validates a folder name to ensure it does not contain invalid characters and that any colon (:) appears only at the second position. The folder name is considered invalid if it contains any of the following characters: * ? " < > |, or if a colon (:) appears anywhere other than the second character (e.g., C:\ is valid). |
|
|
Initializes and loads all required input for script execution. This includes: - Localizing table and field names. - Loading general script input values. - Setting global variables and paths. - Reading Category Wizard field links and parameters. - Determining the document extension and type based on postFlag. Returns True if all operations succeed; otherwise, returns False. |
|
|
Loads values from the temporary output file created by the custom post-event script. This method is intended to be called from a custom `DataEntr_PostEvent.LST` or `DataEntr_PostEvent` method after the custom logic has executed. It reads the "DataEntr_PostEvent.IN" file from the system temp path, parses key-value pairs, and sets corresponding properties such as NewNumber, NewFileName, NewFolderPath, etc. |
|
|
MemberwiseClone |
(Inherited from Object.) |
|
Performs validation checks before executing file operations such as Save As or Rename. Checks performed: •Save As context: If context = "GET_FILENAME_BEFORE_SAVEAS" and a valid part/assembly UID is provided, checks for existing associated drawings. If any are found, displays a warning that CAD Save As will not include drawings. •Rename context: If context = "RENAME", ensures a valid UID is present and that the file is not a drawing. - If UID is missing, shows an error message. Return Value True if all checks pass; otherwise, False. |
|
|
ToString |
(Inherited from Object.) |
Properties
|
Name |
Description |
|---|---|---|
|
Indicates whether the current operation was triggered from the "OnAddDocument" event. |
|
|
Gets the current execution context of the operation (e.g., "SAVE_AS", "RENAME", "ADD_CONFIGURATION"). This value determines how scripts and event logic behave depending on the type of action being performed. |
|
|
Gets the maximum number of category levels that can be assigned to the current document. This value is typically determined based on system or configuration limits and is used to control how many category fields are processed or output. |
|
|
Gets the name of the document field at the specified index that is linked to a category. This represents one of the field names used to store category values in the document. |
|
|
Gets the number of document fields that are linked to categories. This indicates how many field names are currently stored in the NameFieldsLinkedToCategories list. |
|
|
Gets the original directory path of the document before any processing or renaming. |
|
|
Gets the full original path of the document. |
|
|
Specifies whether a global counter should be used for all prefixes when generating new IDs. A non-zero value enables the use of a single global counter across different category prefixes. |
|
|
Gets the category value at the specified index to be assigned to a document field. This value corresponds to the field at the same position in NameFieldsLinkedToCategories, and represents the data to be output to the document during category-based operations. |
|
|
Gets the number of category values currently available in ValueFieldsLinkedToCategories. This count typically matches the number of linked document fields and is used to control output operations. |
See Also