Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Plane names with "Plane" in the name

Status
Not open for further replies.

Spurs

Mechanical
Nov 7, 2002
297
0
0
CA
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
 
Replies continue below

Recommended for you

In your Options (Tools > Options > System Options), make sure your default template directory hasn't changed (in File Locations tab or something). Sounds like perhaps you had default part and assembly templates, upgraded SolidWorks, and now SolidWorks is looking in the default directory. Or perhaps upon upgrade, you didn't move your previously-saved templates into the new directory created by SolidWorks.

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
Reason trumps all. And awe trumps reason.
 
Are you sure you are not just opening a different part/assy template?

[cheers]
Helpful SW websites faq559-520​
How to find answers ... faq559-1091​
SW2006-SP5 Basic ... No PDM​
 
I checked and my default template is the same as always. But it doews open up only saying front top and right where before it opened up saying front plane, right plane and top plane.

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?

 
You'll have to make absolutely sure you're using the same templates anywhere you go. So you'll need to take them along and tell SW which directory to find them.

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
Reason trumps all. And awe trumps reason.
 
I've just noticed that the templates in C:\Program Files\SolidWorks\Lang\English\Tutorial does not use the "Plane" suffix but C:\Program Files\SolidWorks\Samples\Tutorial\AdvDrawings does.

Is your Tools > Options > System Options > Default Templates pointing to one of these or a custom version stored elsewhere?


[cheers]
Helpful SW websites faq559-520​
How to find answers ... faq559-1091​
SW2006-SP5 Basic ... No PDM​
 
This is the location of the default template:

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?

 
Simply right-click each plane > Properties, then add " plane" to all planes, then save that file as a template. My templates have:
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
 
smcadman

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?
 
It was like that since SW04, but I do not know if someone changed it before I worked here. It shouldn't matter, just rename the planes and see if your macro works with the plane name changes. Besides, what have you got to lose since your macro isn't working anyway?

SW06 SP5.0

Flores
 
Smcadman

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?
 
Here is a macro from Solidworks API Help section. It uses the index position of the plane instead of its name. Perhaps a similar procedure can be implemented with your macro.
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
'----------------------------------------------
 
How about this?
Ken

Code:
Dim swFeat As SldWorks.feature
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
 
Status
Not open for further replies.
Back
Top