Feature Manager Tree Display Options

Greetings and Salutations,

I've recently had the pleasure (?) of upgrading my SolidWorks from 2003 to 2004 and then shortly thereafter 2005.

With the myriad of menu changes (which coincidentily added a plethora of additional mousepicks) came the change in the Feature Manager Tree (FMT) Display options.

In 2003, for an assembly, I would separate the FMT into 2 panes and select show dependencies for the bottom pane. This would allow immediate hightlight of the part in question with easy access to the part's mates.

In 2004/5 we get a combination option called Tree Display which combines two functions that were seperate. The areas of interest are the last two selections 1) View Features and 2) View Mates and Dependencies. So to accomplish the same functionality as 2003, I get to make the menu section with two picks instead of one previously.

The really big problem I'm running into, is when some other function switches to the property manager, I then have to resize my FMT window, but of course I have to reselect my display options because the panes are now both one or the other option.

Now I know better than to ask if this "feature" can be turned off, but can the resizing and section of FMT options be accomplished via a macro? I've gotten pretty good at writing macros, but don't wish to spend a day reading the API documentation to find out that it's almost possible if I can avoid it.

Anyone have any ideas? If it is possible, I will write the macro and make available to all who want it.

Thanks in advance.

Chris

Reply to
cdubea
Loading thread data ...

Here are a couple of my favorites for managing the unmanageable. There does not appear to be a way to control which tab is visible though. Argh.

' ***********************************************************************

******* 'Splitterfixer by Dale Dunn ' *********************************************************************** ******* Dim swApp As SldWorks.SldWorks Dim Part As SldWorks.ModelDoc2 Dim Splitterpos As Double

Sub main()

Set swApp = CreateObject("SldWorks.Application") Set Part = swApp.ActiveDoc Splitterpos = Part.FeatureManagerSplitterPosition Select Case Round(Splitterpos, 1) Case 0.5 Part.FeatureManagerSplitterPosition = 1 Case Else Part.FeatureManagerSplitterPosition = 0.5 End Select

End Sub

' ***********************************************************************

******* ' C:\TEMP\swx280\Macro1.swb - macro recorded on 10/06/99 by jgigl ' modified by Dale Dunn ' *********************************************************************** ******* Dim swApp As Object Dim model As Object Dim Gtol As Object Dim FeatureData As Object Dim Feature As Object Dim Component As Object Dim size As Long Dim retval As Long Sub main()

Set swApp = CreateObject("SldWorks.Application") Set model = swApp.ActiveDoc Select Case model.GetFeatureManagerWidth() Case 225 retval = model.SetFeatureManagerWidth(300) Case 300 retval = model.SetFeatureManagerWidth(450) Case Else retval = model.SetFeatureManagerWidth(225) End Select End Sub

Reply to
Dale Dunn

Turned out it was easier than I thought,

Here ya go!

Option Explicit Public Enum swFeatMgrPane_e swFeatMgrPaneTop = 0 swFeatMgrPaneBottom = 1 swFeatMgrPaneTopHidden = 2 swFeatMgrPaneBottomHidden = 3 End Enum

Sub main() Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Dim pModViewMgr As SldWorks.ModelViewManager Dim swFeatMgrTabTop As SldWorks.FeatMgrView Dim swFeatMgrTabBtm As SldWorks.FeatMgrView Dim nActivePane As Long Dim nViewHwnd As Long Dim retval As Variant

Set swApp = CreateObject("SldWorks.Application") Set swModel = swApp.ActiveDoc() Set pModViewMgr = swModel.ModelViewManager

swModel.FeatureManagerSplitterPosition = 0.5 nActivePane = pModViewMgr.GetFeatureMgrViewHWnd(swFeatMgrPaneTop) swModel.ViewFeatureManagerByFeatures nActivePane = pModViewMgr.GetFeatureMgrViewHWnd(swFeatMgrPaneBottom) swModel.ViewFeatureManagerByDependencies

retval = swModel.ForceRebuild3(True)

End Sub

Make certain to set the following References

1) swvba.tlb 2) sldworks.tlb 3) swconst.tlb 4) swpublished.tlb

Let me know and I can e-mail you the swp file. Don't e-mail to the listed address, it's entirely fictional. I don't put real e-mail addresses in Usenet messages anymore. Learned that lesson the hard way!

Chris

Reply to
cdubea

Or not. It's not correctly activating the panes.

Don't try this until further notice.

Sorry,

CD

Reply to
cdubea

I can get the handle of the pane in the Feature Manager Tree. The problem is I just can't figure out how to activate the pane with that handle. Needless to say the documentation is sparse. As best I can tell you can only activate a pane which you create, which is definately not what I wan't to do.

Any ideas?

Chris

Reply to
cdubea

Heh. Too late. I got all excited thinking you have found a way to activate different tabs.

Reply to
Dale Dunn

I reached the same conclusion when I tried a couple years ago. I don't remmeber the calls anymore, but it seemed like it would be possible to change the tab if I just knew it's name. I couldn't find an enumeration of the names, so I tried a few integer values. That didn't work either. I gave up.

Reply to
Dale Dunn

Hot dog!

I got it. I had to fool it, but it works.

This will toggle the feature manager tree display between all one pane to 1/2 and 1/2.

In the full pane view it will show features, in the 1/2 and 1/2 it will show by features on top and dependencies on bottom!

Save it as a macro and assign it to a key or a button. This is tremendous.

Option Explicit

Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Dim swFeatMgr As SldWorks.FeatureManager Dim swAssy As SldWorks.AssemblyDoc Dim Splitterpos As Double

Sub main()

Set swApp = CreateObject("SldWorks.Application") Set swModel = swApp.ActiveDoc Set swAssy = swModel Set swFeatMgr = swModel.FeatureManager Splitterpos = swModel.FeatureManagerSplitterPosition Select Case Round(Splitterpos, 1) Case 0.5 swModel.FeatureManagerSplitterPosition = 1 swAssy.ViewFeatureManagerByFeatures Case Else swModel.FeatureManagerSplitterPosition = 0# swAssy.ViewFeatureManagerByFeatures swModel.FeatureManagerSplitterPosition = 1# swAssy.ViewFeatureManagerByDependencies swModel.FeatureManagerSplitterPosition = 0.5 End Select swFeatMgr.UpdateFeatureTree End Sub =========================================================================== Chris

Reply to
Chris Dubea

Crap!!!!!!

Now the stupid thing doesn't work. I'll get back to you.

=========================================================================== Chris

Reply to
Chris Dubea

Yes, I'm now officially losing my mind. If any of you finds a mind laying around it probably belongs to me.

Testing this again proves it functional.

Can someone else test this for me and tell me if I'm brain dead or a genius?

Thanks in advance.

Option Explicit

Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Dim swFeatMgr As SldWorks.FeatureManager Dim swAssy As SldWorks.AssemblyDoc Dim Splitterpos As Double

Sub main()

Set swApp = CreateObject("SldWorks.Application") Set swModel = swApp.ActiveDoc Set swAssy = swModel Set swFeatMgr = swModel.FeatureManager Splitterpos = swModel.FeatureManagerSplitterPosition Select Case Round(Splitterpos, 1) Case 0.5 swModel.FeatureManagerSplitterPosition = 1 swAssy.ViewFeatureManagerByFeatures Case Else swModel.FeatureManagerSplitterPosition = 0# swAssy.ViewFeatureManagerByFeatures swModel.FeatureManagerSplitterPosition = 1# swAssy.ViewFeatureManagerByDependencies swModel.FeatureManagerSplitterPosition = 0.5 End Select swFeatMgr.UpdateFeatureTree End Sub

=========================================================================== Chris

Reply to
Chris Dubea

Which one is it? There are several.

Anyhow, your macro is a lot longer than mine, for some reason. It looks like you're controlling the content too, which I never managed. AFter trying it though. It seems to accomplish the exact same thing, except being specific to assembly docs. Why did you want that?

Ironically, we chose a lot of the same variable names. Great minds think alike even if they are just lying around.

' **************************** 'Splitterfixer by Dale Dunn ' **************************** Dim swApp As SldWorks.SldWorks Dim Part As SldWorks.ModelDoc2 Dim Splitterpos As Double

Sub main()

Set swApp = CreateObject("SldWorks.Application") Set Part = swApp.ActiveDoc Splitterpos = Part.FeatureManagerSplitterPosition Select Case Round(Splitterpos, 1) Case 0.5 Part.FeatureManagerSplitterPosition = 1 Case Else Part.FeatureManagerSplitterPosition = 0.5 End Select

End Sub

Reply to
Dale Dunn

Ok,

I got an official ruling from tech support. There is no ability to activate existing feature manager windows.

So, unless I can figure out a way to trick the thing, there will never be a foolproof way of doing what I want.

The issue here is the featuremanager manipulation tools only operate on the "bottom" window. There is no official manner to activate the top window.

As long as the top window is set to show features the script shown earlier will set the bottom one to show dependencies. That is why it seems like it works sometimes nad not others.

Thanks to all how opined.

cd

Reply to
cdubea

Rats. I was hoping you were onto something there...

Reply to
Dale Dunn

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.