Plane names with "Plane" in the name
Plane names with "Plane" in the name
(OP)
When solidworks opens a new part file, the 3 default planes are displayed named - "front plane", "right plane" and "top plane".
I accidentally clicked on something - dont know what - that when the default file loads, it just loads "front", "right" and "top". The result is that VBA code which was written with the full name ie. "right plane" does not recognize the correct plane anymore.
Can someone guide me to resolve this issue:
1) manually
2) using vba code so that if a file does open this way, it can be automatically corrected
Thanks
I accidentally clicked on something - dont know what - that when the default file loads, it just loads "front", "right" and "top". The result is that VBA code which was written with the full name ie. "right plane" does not recognize the correct plane anymore.
Can someone guide me to resolve this issue:
1) manually
2) using vba code so that if a file does open this way, it can be automatically corrected
Thanks






RE: Plane names with "Plane" in the name
Because of this sort of thing, I save my template files in a non-standard place on my D drive--keeps things consistent.
Jeff Mowry
www.industrialdesignhaus.com
Reason trumps all. And awe trumps reason.
RE: Plane names with "Plane" in the name
RE: Plane names with "Plane" in the name
What is the default for SW? with or without the plane suffix?
How is this controlled so that when i run a macro on different computers, it will always work?
RE: Plane names with "Plane" in the name
I'm convinced that your templates have changed--either SW is looking in a different directory or you changed what the templates say and saved them. SW won't change the template files on its own.
Have you upgraded or uninstalled/reinstalled?
To fix this, open your template file and change the plane names back to what they're called in the macro. Save the templates. Or redirect SolidWorks to the correct directory. Multiple installations of SW will each have their own set of "default" templates--if you have customized the templates, you'll need to direct SW where to find the custom versions.
Jeff Mowry
www.industrialdesignhaus.com
Reason trumps all. And awe trumps reason.
RE: Plane names with "Plane" in the name
RE: Plane names with "Plane" in the name
Is your Tools > Options > System Options > Default Templates pointing to one of these or a custom version stored elsewhere?
RE: Plane names with "Plane" in the name
C:\Program Files\SolidWorks\data\templates\Part.prtdot
This template uses the "plane" suffix. This is identical to what was installed when I put SW 2006 on the system.
However, this particular computer first had SW2005 loaded, and then 2006 - both systems are operating.
My SW2005 default is the identical file as the 2006 version.
Is there a way in VBA code to change the name of the plane one way or another jsut in case some other default method is loaded?
RE: Plane names with "Plane" in the name
Front Plane
Top Plane
Right Plane
On a side note, I have renamed our standard templates by adding the company initials on the end of each template so that there will be no confusion as to what you are using.
Basically:
Assembly_PF.asmdot
Part_PF.prtdot
Drawing_PF.drwdot
In addition to checking where CBL stated, also check:
Tools > Options > System options tab > File locations > Show folders for: Document templates from drop-down list.
SW06 SP5.0
Flores
RE: Plane names with "Plane" in the name
Did you add "plane" to each of your defaults or is that how it loaded on its own?
Is there some sort of global command that does this?
RE: Plane names with "Plane" in the name
SW06 SP5.0
Flores
RE: Plane names with "Plane" in the name
The macro can be fixed - thats not the issue - the issue is that the same macro can be used by others in our company - posslibly each computer being slightly different.
So the question would be, is there way to either set a global command in the macro to be able to rename all planes in a new part file one way or another?
RE: Plane names with "Plane" in the name
Select Plane Example (VB)
This example shows how to select the default SolidWorks Right Plane.
'----------------------------------------------
'
' Preconditions: Model document is open.
'
' Postconditions: Default SolidWorks Right Plane is selected.
'
'----------------------------------------------
Option Explicit
Sub main()
' Select Right Plane (1-based index)
Const ReqPlane As Long = 3
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swFeat As SldWorks.feature
Dim PlaneCount As Long
Dim bRet As Boolean
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swFeat = swModel.FirstFeature
Do While Not swFeat Is Nothing
If "RefPlane" = swFeat.GetTypeName Then
PlaneCount = PlaneCount + 1
If ReqPlane = PlaneCount Then
bRet = swFeat.Select2(False, 0): Debug.Assert bRet
Exit Do
End If
End If
Set swFeat = swFeat.GetNextFeature
Loop
End Sub
'----------------------------------------------
RE: Plane names with "Plane" in the name
Ken
CODE
Dim FirstPlane As String
Dim SecondPlane As String
Dim ThirdPlane As String
Dim intCount as Integer
Set swFeat = swModel.FirstFeature
intCount = 1 'Counter
Do While Not swFeat Is Nothing
If swFeat.GetTypeName = "RefPlane" Then
Select Case intCount
Case 1
FirstPlane = swFeat.Name
Case 2
SecondPlane = swFeat.Name
Case 3
ThirdPlane = swFeat.Name
Exit Do
End Select
intCount = intCount + 1
End If
Set swFeat = swFeat.GetNextFeature
Loop
Red Flag Submitted
Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.
Reply To This Thread
Posting in the Eng-Tips forums is a member-only feature.
Click Here to join Eng-Tips and talk with other members!