Multiple Drawing views renaming

There have been similiar questions in the past. However none of the answers that were given were anything I, with my close to none existent knowledge of macro's, could understand enough to make what I wanted.

If a kind soul has a moment to make this it would be greatly appreciated.

Desired result.

In a drawing on the first, =default sheet, (does not have to check for other sheets) to rename Drawing View1 to "Front", Drawing View 2 to "Top" and Drawing View 3 to "Side".

There doesn't have to be error checking or other foul and full proof measures. Which means that I would expect it to be kind of easy to make.

I tried record macro but that didn't do much.

Thank you in advance.

SolidworksApi macros
Answers 2
KR
KR 2015-03-17 Best Answer
<p>Dim swApp As SldWorks.SldWorks</p><p>Dim swModel As SldWorks.ModelDoc2</p><p>Dim swFeat As SldWorks.Feature</p><p>Dim swSubFeat As SldWorks.Feature</p><p></p><p>Sub main()</p><p>    Set swApp = Application.SldWorks</p><p>    Set swModel = swApp.ActiveDoc</p><p>    Set swFeat = swModel.FirstFeature</p><p>    </p><p>    Do While Not swFeat Is Nothing</p><p>        </p><p>        Set swSubFeat = swFeat.GetFirstSubFeature</p><p>        Do While Not swSubFeat Is Nothing</p><p>            Select Case swSubFeat.Name</p><p>                Case "Drawing View1"</p><p>                    swSubFeat.Name = "Front"</p><p>                Case "Drawing View2"</p><p>                    swSubFeat.Name = "Top"</p><p>                Case "Drawing View3"</p><p>                    swSubFeat.Name = "Side"</p><p>            End Select</p><p>            </p><p>            Set swSubFeat = swSubFeat.GetNextSubFeature</p><p>        Loop</p><p>        </p><p>        Set swFeat = swFeat.GetNextFeature</p><p>    Loop</p><p>End Sub</p>

Keith

SolidWorks API Tutorials

PV
PV 2015-03-18

Keith,

Thank you kindly.

That indeed does exactly what I wanted.

Cheers.

Have a nice one

Peter