FeatureManager C++

Discussion in 'SolidWorks' started by Andreas, Nov 12, 2003.

  1. Andreas

    Andreas Guest

    Hello,

    I am writing a Addin for SW2003 with Visual C++ 7.

    I have created a new FeatureManager design tree view with the
    following methods


    ModelDoc2->ICreateFeatureMgrView3 ( bitmap, toolTip, whichPane,
    &retval )

    retval->GetFeatMgrViewWnd(&handle)


    The command creates a new (empty) view, but I don´t know what to do
    with the returned CWnd handle (long) retval. I would like to add some
    controls and other stuff, is this possible at all?
    I´m very confused. Can someone give me a hint?

    Regards,
    Andreas
     
    Andreas, Nov 12, 2003
    #1
  2. the CWnd is a regular MS Windows structure.
    As said on the "Add Tab in FeatureManager Design Tree Example (VB)" page in
    apihelp:

    ' Adding a custom tab to the FeatureManager Design Tree was
    ' previously only available to MFC-extension DLL addins and
    ' required a strong knowledge of MFC, Windows messaging, and
    ' Windows SDK. Problems were difficult to diagnose and
    ' fix.
    ' Further, the SolidWorks APIs for adding a tab to the
    ' FeatureManager design tree were highly MFC specific and,
    ' as such, were not COM-compliant.

    ' SolidWorks now has the ability to instantiate any

    ' arbitrary ActiveX control as a tab in the FeatureManager
    ' design tree. The new APIs are now fully COM-compliant
    ' and reduce the knowledge required for adding a tab.

    so you'd better make an ActiveX control that does the job and place it on
    the FM with

    ModelViewManager::CreateFeatureMgrControl
     
    Philippe Guglielmetti, Nov 13, 2003
    #2
  3. Andreas

    Andreas Guest

    Thanks for the response. I think you are right, the Activex control is
    the better way.
    So I made an control an tried to implement it in SW. Doing this with
    VB was no Problem (there is an example on solidworks.com), but I can´t
    manage it with VC++. Here are some pieces of the code i used


    #import "c:\\test.ocx"
    ..
    ..
    ..

    CComPtr<IModelDoc2> ModDoc;
    CComPtr<IFeatMgrView> MgrView;
    CComPtr<IModelViewManager> ModView;


    iSwApp->get_IActiveDoc2(&ModDoc);

    ModDoc->get_ModelViewManager(&ModView);


    ModView->CreateFeatureMgrControl(icon,
    A2BSTR("TEST.testCtrl.1"),A2BSTR(""),A2BSTR("Tip"),
    swFeatMgrPaneBottom, &MgrView);


    The code does .
     
    Andreas, Nov 15, 2003
    #3
  4. Andreas,

    Your code looks OK to me - I don't know what problem you are having.

    I have put a BSD licensed sample on my downloads page (
    http://www.cadcambridge.net/downloads.html ) that is equivalent to the SDK
    VB sample, but implemented in C++. Hope this helps you out.
     
    Paul Delhanty, Nov 15, 2003
    #4
  5. Andreas

    Andreas Guest

    Hello Paul

    Thank you very much!!! This is a very good example and it helped me to
    solve the problem. Something with the picture stuff was wrong.

    bye
     
    Andreas, Nov 16, 2003
    #5
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.