ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
ASAlessandro Sanzone07/01/2025

I'm trying to replace the model of an existing drawing using the ReplaceViewModel Method, via Python (SolidWorks 2024 and VS Code 1.96.0) but I can't manage to make it work.

Here's my code:

swApp = win32com.client.Dispatch('SldWorks.Application')
drawing = swApp.ActiveDoc
new_model_path = r'C:\Path\To\My\ModelSLDPRT'
view = drawing.FeatureByName('Drawing View1')
views = [view]
drawing.ReplaceViewModel(new_model_path,