LeaCar Mechanical Desktop Re-Link Utility and VBA Utility Class March 4, 2002 For Mechanical Desktop 6 (tested on SP2 and SP3) (Should work on Mechanical Desktop 5 also, Not Tested) Thanks to Randall Rath/VB Design for the FileDialog Class. http://www.vbdesign.net LeaCar Consulting Inc. 1604 Fairmont Dr. New Kensington, PA 15068-5858 USA http://www.leacar.com 724.448.2672 724.339.0958 FAX support@leacar.com 1.)DISCLAIMER/COPYRIGHT Copyright (c) 2001, 2002 by LeaCar Consulting Inc. All rights reserved. LeaCar Consulting Inc. (hereafter "LCI") provides this software "as is" and with all faults. LCI specifically disclaims any implied warranty of merchantability or fitness for a particular use. LCI does not warrant that the operation of the software will be uninterrupted or error free. Use at your own risk. You are hereby granted permission to use, copy and modify this software without charge, provided you do so exclusively for your own use or for use by others in your organization in the performance of their normal duties, and provided further that the above copyright notice and the limited warranty and restricted rights notice above remain in all copies. Incorporation of any part of this software into other software, except when such incorporation is exclusively for your own use or for use by others in your organization in the performance of their normal duties, is prohibited without the prior written consent of LCI. Copying, modification and distribution of this software or any part thereof in any form except as expressly provided herein is prohibited without the prior written consent of LCI. 2.)SUPPORT This is free software and as such is not officially supported. However, If you would like to be notified of updates (issued solely at our discretion), please send your name (no aliases please) and email address (and optionally street address) to support@leacar.com Problems can be reported to support@leacar.com Please see http://www.leacar.com/leacar_legal.htm for our privacy policy. 3.)RE-LINK UTILITY This utility is designed to change the filename and path definitions of Excel Spreadsheets linked to Global and Local Variables within Mechanical Desktop. This is especially useful in cases where you would like to rename and/or relocate the Excel file linked to your model but do not want to spend the time to individually un-link and re-link the each part to the new file. The user can select any or all of the link definitions to update from a list box displaying the current settings. The user can browse for a new spreadsheet filename/path or use the currently open Workbook. This utility does not change the Worksheet Name and Column/Row layout. These must remain as defined. Links for External Part Files are not updated. To start the utility, Run the 'ChangeLinkedFile' macro. 4.) MDT UTILITY CLASS Properties: MDTAppObject (Read Only) - The Mechanical Desktop Application Object Version (Read Only) - The class module version Methods: GetCompFromName - Returns an McadComponent object from the given instance name. RetVal = object.GetCompFromName (Instance, Component) RetVal: True if component is found, otherwise False. Instance: The instance (Part) name to find. Component: The McadComponent object. GetAcadEntFromComp - Returns an AcadEntity object from the McadComponent object. RetVal = object.GetAcadEntFromComp (Component) RetVal: Component: The McadComponent object. GetPartFromComp - Returns an McadPart object from the McadComponent object. RetVal = object.GetPartFromComp (Component) RetVal: Component: The McadComponent object. UpdateAllParts - Same as AMUPDATE aLl at the command line. object.UpdateAllParts UpdateAssembly - Same as AMUPDATE Assembly at the command line. object.UpdateAssembly UpdateAllLinks - Same as AMUPDATE linKs at the command line. object.UpdateAllLinks GetCompFromDef - Returns the first McadComponent object in the assembly tree from the given Component Definition. RetVal = object.GetCompFromDef (Definition, Component) RetVal: True if a matching component is found, otherwise False. Instance: The definition to find. Component: The McadComponent object. SaveActiveInstance - Save the active instance (to be restored by RestoreActiveInstance) RestoreActiveInstance - Restore the active instance (that was saved by SaveActiveInstance) object.SaveActiveInstance object.RestoreActiveInstance Note: The saved instance is only valid while the scope of the class object is active. IsPartLinked - Determines if an McadPart is linked to a spreadsheet. RetVal = object.IsPartLinked (Part) RetVal: True if Part is linked, otherwise False. Part: The McadPart object to be tested. IsGlobalLinked - Determines if an McadDocument is linked (Global Variables) to a spreadsheet. RetVal = object.IsGlobalLinked (Document) RetVal: True if Document is linked, otherwise False. Part: The McadDocument object to be tested.