All,
I'm tweaking my clean up utility to be able to unfiy the scene settings in my parts/assemblies.
Doing some spelunking I've come across the DelecteScene function: https://help.solidworks.com/2017/Englis ... Scene.html
To be kind, documentation is kinda sparse.
Has anyone gotten this to work? More importantly has anyone gotten this to work under VBA?
Thanks
DeleteScene Method (IModelDocExtension)
Re: DeleteScene Method (IModelDocExtension)
It pretty much works as advertised. Here's a before:
And here's the after:
Here's some code:Code: Select all
Dim swApp As SldWorks.SldWorks
Dim mDoc As ModelDoc2
Dim mExt As ModelDocExtension
Sub main()
Set swApp = Application.SldWorks
Set mDoc = swApp.ActiveDoc
Set mExt = mDoc.Extension
mExt.DeleteScene
End Sub
Re: DeleteScene Method (IModelDocExtension)
It works for me when I run my code, but I had to test a few things to make sure I knew what was going on.
You can delete a scene, however there needs to be a scene applied to the part so SW re-applies the default theme. This is why it doesn't appear that the scene is deleted from the feature tree.
You can delete a scene, however there needs to be a scene applied to the part so SW re-applies the default theme. This is why it doesn't appear that the scene is deleted from the feature tree.
Re: DeleteScene Method (IModelDocExtension)
Works perfectly.JSculley wrote: ↑Wed Feb 15, 2023 7:45 am It pretty much works as advertised. Here's a before:
image.png
Here's some code:
And here's the after:Code: Select all
Dim swApp As SldWorks.SldWorks Dim mDoc As ModelDoc2 Dim mExt As ModelDocExtension Sub main() Set swApp = Application.SldWorks Set mDoc = swApp.ActiveDoc Set mExt = mDoc.Extension mExt.DeleteScene End Sub
image.png
Thank you