Feature Manager Tree Display Options

Discussion in 'SolidWorks' started by cdubea, Apr 6, 2005.

  1. cdubea

    cdubea Guest

    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
     
    cdubea, Apr 6, 2005
    #1
  2. cdubea

    cdubea Guest

    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
     
    cdubea, Apr 6, 2005
    #2
  3. cdubea

    cdubea Guest

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

    Don't try this until further notice.

    Sorry,

    CD
     
    cdubea, Apr 6, 2005
    #3
  4. cdubea

    cdubea Guest


    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
     
    cdubea, Apr 7, 2005
    #4
  5. cdubea

    Chris Dubea Guest


    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
     
    Chris Dubea, Apr 21, 2006
    #5
  6. cdubea

    Chris Dubea Guest

    Crap!!!!!!

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


    ===========================================================================
    Chris
     
    Chris Dubea, Apr 21, 2006
    #6
  7. cdubea

    Chris Dubea Guest

    On Fri, 21 Apr 2006 10:11:33 -0500, 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
     
    Chris Dubea, Apr 21, 2006
    #7
  8. cdubea

    cdubea Guest

    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
     
    cdubea, Apr 27, 2006
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.