Looking for a macro to Macro to reorder "Auxiliary views" labels alphabetically backwards from Z – A. I have a macro that does sections from A-Z, but our company standard requires auxiliary views to be reversed.
When you say re-order, do you mean renaming the drawing views in the feature tree or adding a label below the drawing view e.g. "View Z", "View Y" in the drawing sheet? What about the main drawing view from which other projected view are created and detail views?
To define reorder. Scan the complete drawing, all sheets. Rename all "projected views" in a "View Z", "View Y" ...sequence in the drawing sheet.
Labels are driven by the view "arrow" tag
Try attached macro. I have created it in SolidWorks 2015, so you will have to re-reference libraries if you are using 2016 or 2017 version. If you have more than 26 views in the drawing, the macro will go back to 'Z' after reaching 'A' and starts working backward again. You may want to change it.
Let me know how you go.
I replaced all references except i don't see a update for "SolidWorks utilities 2015 type library". So i haven't been able to run it yet.
Also i might need to clarify/correct my question. I'm looking to reorder the labels of "Auxiliary" views, as shown in the previous screenshots.
Still looking to update the references...the macro runs but no changes....but no errors either.
Copy the contents of the macro into notepad. Create a new macro and paste the contents from notepad. It should fix the problem.
As you asked in your first question, it reorders the 'Projected Views' only. If the view is not projected it doesn't do any thing with that particular view. If you want the macro to change the labels of 'Auxiliary View' just change the condition 'If swView.Type = swDrawingViewTypes_e.swDrawingProjectedView Then' to 'If swView.Type = swDrawingViewTypes_e.swDrawingAuxiliaryView Then'.
As Chris Champions mentioned, you should merge both macros into one instead of running two separate macros.
I had already changed the swDrawingAuxiliaryView variable & tried it. I get a "Failed to rename View15". So i know it is fining the view, because view15 is an auxiliary view, but it fails to rename it.
Am I missing something here: If you have a loop from A-Z in your macro, why don't you switch back from Z-A
I think Chris is onto something here
Just a though: if you go from A-Z, there might a chance you run out of the letter so the next will be AA, similar as revision
if you want from Z-A, what happens if run out of the letter?
Could you post the A->Z reordering macro?
I cannot post my macro as my company will not allow it, however i can give you a link i had found & modified for my use.
it is here: https://forum.solidworks.com/message/327608#comment-327608 it is one of Artem Taturevych contributions
If you still use most of the code in that macro, you should change one line in main and a bit more in GetNextName:
In sub main:
Change "curChar = A_CHAR" into "curChar = Z_CHAR"
Function GetNextName() As String
If curChar < A_CHAR Then
GetNextName = Chr(curChar) & curText
curChar = curChar - 1
I See the objects in the select case, but need to add condition for "Auxiliary View":
DrSection - which gives me functions and methods for Section View including changing label
DetailCirlce - which gives me functions and methods for Detail View including changing label
But I can't find the same pointer to Auxiliary View.
Dose it exists or the interface to Auxiliary View is done some other way?
I can't find any interface for Auxiliary View like Section View or Detail View.
The macro only works for the 'Projected View' as you originally asked but does not work for the 'Auxiliary View'. It gets the IProjectedArrow object and IProjectedArrow.GetLabel Method also works but IProjectedArrow.SetLabel doesn't work and therefore you get an error message.
Not sure of any other method to do it.
Thanks, appreciate the effort...
I cant believe they(SolidWorks) would drop the ball on not having the method for Auxiliary, just like section and detail.
I thought you used that macro only as a reference? If that's the case you can adjust your working macro using my proposed changes, right? Or is the auxiliary view your main question? I guess I can read your initial post that way now
I have the macro (i altered to do some additional things) that does the "Section" & "Detail" view labels per our A,B,C....company standard.
My focus now is on the "Auxiliary" type view labels to be Z,Y,X,...per our company standard
Email from my VAR
It would appear that the code to get this to work should look like this: If swView.Type = swDrawingViewTypes_e.swDrawingAuxiliaryView Then Dim swProjArrow As SldWorks.ProjectionArrow Set swProjArrow = swView.GetProjectionArrow Debug.Print swProjArrow.GetLabel boolstatus = swProjArrow.SetLabel("B") 'SPR 973603 Debug.Print boolstatus End If However, commented in that code is SPR 973603 which reads "SetLabel Method (IProjectionArrow) fails to set the arrow label for Auxiliary Views". It appears that this code should work, but will fail due to this bug
Retrieving data ...