AnsweredAssumed Answered

How to Replace model reference in view on drawing

Question asked by Yong Ning on Apr 19, 2016
Latest reply on Apr 20, 2016 by Yong Ning

changeModelName.jpg

Follow code , don't change  View reference Model name.

Private Sub ll()

   Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2, oModel As ModelDoc2

       Set SwApp = Application.SldWorks

       Set SwModel = SwApp.ActiveDoc

   Dim SwSelMgr As SelectionMgr

       Set SwSelMgr = SwModel.SelectionManager

   Dim SwView As View

       Set SwView = SwSelMgr.GetSelectedObject5(1)

       Debug.Print SwView.Name,

       Set oModel = SwView.ReferencedDocument

       Debug.Print oModel.GetPathName

       tmp = SwView.LoadModel

       Stop

   

 

End Sub

*************************************************************************

2014 SOLIDWORKS Help - Replacing Model in a Drawing View  http://help.solidworks.com/2014/English/SolidWorks/sldworks/t_replace_model_in_view.htm

Manual method

 

OpenModel.jpg

 

To edit part location:

 

 

Click File, Open, References, or click File, Save As, References.

In the New pathname list, select a path or filename that you want to edit , or click Select All.

You can edit the path or filename using one of the following methods:

Select a list entry by double-clicking. Browse to a new folder or type a new name in the Open dialog box, then click Open.

Select the check box for a list entry and click Browse to change to a new drive or directory path. The new drive or path appears in the New folder box.

 

 

Click Replace and enter a word to find and a word to replace with. (For example, change "\samples" to "\archive" to move one or all part files to the archive directory.) Click the Match case check box if the case is significant in the search.

Outcomes