×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Plane names with "Plane" in the name

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

RE: Plane names with "Plane" in the name

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
www.industrialdesignhaus.com
Reason trumps all.  And awe trumps reason.

RE: Plane names with "Plane" in the name

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

RE: Plane names with "Plane" in the name

(OP)
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?

RE: Plane names with "Plane" in the name

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
www.industrialdesignhaus.com
Reason trumps all.  And awe trumps reason.

RE: Plane names with "Plane" in the name

The SW default is Front, Top & Right.

cheers
Helpful SW websites FAQ559-520
How to find answers ... FAQ559-1091

RE: Plane names with "Plane" in the name

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

RE: Plane names with "Plane" in the name

(OP)
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?

RE: Plane names with "Plane" in the name

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

RE: Plane names with "Plane" in the name

(OP)
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?

RE: Plane names with "Plane" in the name

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

RE: Plane names with "Plane" in the name

(OP)
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?

RE: Plane names with "Plane" in the name

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
'----------------------------------------------

RE: Plane names with "Plane" in the name

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

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!


Resources