Problem with Inventor App-wizard

Problem with Inventor App-wizard

Anonymous
Not applicable
442 Views
9 Replies
Message 1 of 10

Problem with Inventor App-wizard

Anonymous
Not applicable
Hi All,

I installed the Autodesk Inventor 9.0 and the App wizard in the SDK folder of the Inventor. I created a sample application. an compiled it without adding any command. It compiled successfully. Now I added a single command, I compiled successfully. But if I add another command and trying to compile the application I am getting the following errors for each newly added command after first one

Compiling...
INCICHECKAddInServer.cpp
E:\ManojKM\INCICHECKAddin\INCICHECKAddInServer.cpp(60) : error C2086: 'pCommandMgr' : redefinition
E:\ManojKM\INCICHECKAddin\INCICHECKAddInServer.cpp(60) : error C2086: 'pControlDefs' : redefinition
E:\ManojKM\INCICHECKAddin\INCICHECKAddInServer.cpp(60) : error C2374: 'ppsz' : redefinition; multiple initialization
E:\ManojKM\INCICHECKAddin\INCICHECKAddInServer.cpp(58) : see declaration of 'ppsz'
Error executing cl.exe.

INCICHECKAddin.dll - 3 error(s), 0 warning(s)

Do any body has idea what wrong is going with my project?

Thanks in advance

manoj
0 Likes
443 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable
Hi,

I got the work-around. In the macro there is a parameter ID. So I replace all the variable which are redifined by
VARIABLE##ID##.

So its working now.

Thanks
Manoj
0 Likes
Message 3 of 10

Anonymous
Not applicable
Though I am bee able to build the project, but while opening in inventor, The UI is not created. Though the list of Add-in displays that the add-in is loaded at start-up. But the tool bar created is not displayed in the list of tool bars.

Any clue??
0 Likes
Message 4 of 10

Anonymous
Not applicable
Try from the menu

Tools > Customize > Toolbars

find your toolbar and click Show
0 Likes
Message 5 of 10

Anonymous
Not applicable
I did not find my toolbar in Tools > Customize > Toolbars. Though the add-in is loaded and I tried to create a custom tool bar manualy through customize menu and was able to put my new commands on that menu and run it.

Anything else?
0 Likes
Message 6 of 10

Anonymous
Not applicable
There is a defect logged against the problem of the compiler errors when more than one command is added using the wizard. The current target is to fix this in the next Inventor release (Inventor 10). Of course, you can work around this, there are multiple ways to do this, one of this is to just create another macro where the CommandManager and ControlDefinitions objects are initialized, then use these objects for the creation of the commands. I also noticed another problem when adding multiple commands, the CREATE_INV9_APPTOOLBAR macro parameters in the Activate method of the AddIn are being removed, i.e. the second and third parameters which correspond to the toolbar's display name and internal name respectively are being removed. When adding only one command, these parameters are preserved correctly. Therefore, the toolbar is being created except that since a display name or internal name is not supplied, an item is being added to the Tools -> Customize -> Toolbars list, but there is no name associated with it, so the entry is blank. For example, in my case, after placing one command, the macro was: CREATE_INV9_APPTOOLBAR(m_pAppToolBar, L"TestWizard AddIn Toolbar", L"{7AE67B38-6589-4AA1-87CB-550462C5D6BD}", CLSID_TestWizardAddInServer) But, after adding a second command, it becomes: CREATE_INV9_APPTOOLBAR(m_pAppToolBar, L"", L"", CLSID_TestWizardAddInServerServer) Again, this is a problem with the wizard. I will file a defect report to fix this. The workaround in this case is to fill in the second and third parameters of the macro yourself, supply the display name and internal name of the toolbar. Thanks, Venkatesh Thiyagarajan, Autodesk Inc. "manoj_vest" wrote in message news:29970245.1099974397532.JavaMail.jive@jiveforum1.autodesk.com... > I did not find my toolbar in Tools > Customize > Toolbars. Though the add-in is loaded and I tried to create a custom tool bar manualy through customize menu and was able to put my new commands on that menu and run it. > > Anything else?
0 Likes
Message 7 of 10

Anonymous
Not applicable
Venkatesh,

Thanks for your suggestions. But event after supplying the Display name and internal name for the tool bar, I was unable to locate the tool bar in Customize dialog. After that due to some other reason I needed to un-install the Inventor and then again re-install. After re-installing the inventor, I got the tool bar. So I could not predict the reson, but anyway it is working now.

Thanks again
Manoj
0 Likes
Message 8 of 10

Anonymous
Not applicable
I am facing the same problem you mentioned above , and I cannot understand how to fix it even after seeing your solution below, Could you please expain it in more detail?
Thank you very much!
--------------------------------------------
I got the work-around. In the macro there is a parameter ID. So I replace all the variable which are redifined by
VARIABLE##ID##.
0 Likes
Message 9 of 10

Anonymous
Not applicable
This was a problem with the wizard (now fixed in R10). The solution for R9
is to make some minor changes to the CREATE_INV9_COMMAND macro in the
InventorUtils.h file.

If you don't want to make the changes yourself, I have attached the updated
InventorUtils.h file, please use this in each of your AddIn projects instead
of what the wizard produces, just replace the existing file (if you haven't
manually made any changes to it) and re-compile your project.

If you are interested in the changes to the CREATE_INV9_COMMAND macro, here
is the update macro:

#define CREATE_INV9_COMMAND(classname, name, ID, dispName, enabled, tooltip,
desc, hIcon, cmdType, cmdDisplayType, internalName, clientID) \
{ \
HRESULT hr##ID## ; \
CComPtr pCommandMgr##ID## ; \
hr##ID## =m_pApplication->get_CommandManager (&pCommandMgr##ID##) ; \
ATLASSERT( SUCCEEDED( hr##ID## ) ) ; \
CComPtr pControlDefs##ID## ; \
hr##ID## =pCommandMgr##ID##->get_ControlDefinitions (&pControlDefs##ID##)
; \
ATLASSERT( SUCCEEDED( hr##ID## ) ) ; \
HICON h1##ID## =NULL, h2##ID## =NULL ; \
CComPtr pPictureDisp1##ID##, pPictureDisp2##ID## ; \
CComVariant vtIcon1##ID##, vtIcon2##ID## ; \
if ( hIcon != -1 ) { \
PICTDESC pdesc1##ID## ; \
pdesc1##ID##.cbSizeofstruct =sizeof (pdesc1##ID##) ; \
pdesc1##ID##.picType =PICTYPE_ICON ; \
h1##ID## =(HICON)::LoadImage (_Module.GetResourceInstance (),
MAKEINTRESOURCE(hIcon), IMAGE_ICON, 15, 14, LR_LOADTRANSPARENT) ; \
pdesc1##ID##.icon.hicon =h1##ID## ; \
hr##ID## =::OleCreatePictureIndirect (&pdesc1##ID##, IID_IPictureDisp,
FALSE, (LPVOID *)&pPictureDisp1##ID##) ; \
ATLASSERT( SUCCEEDED( hr##ID## ) ) ; \
vtIcon1##ID## =CComVariant (pPictureDisp1##ID##) ; \
PICTDESC pdesc2##ID## ; \
pdesc2##ID##.cbSizeofstruct =sizeof (pdesc2##ID##) ; \
pdesc2##ID##.picType =PICTYPE_ICON ; \
h2##ID## =(HICON)::LoadImage (_Module.GetResourceInstance (),
MAKEINTRESOURCE(hIcon), IMAGE_ICON, 23, 21, LR_LOADTRANSPARENT) ; \
pdesc2##ID##.icon.hicon =h2##ID## ; \
hr##ID## =::OleCreatePictureIndirect (&pdesc2##ID##, IID_IPictureDisp,
FALSE, (LPVOID *)&pPictureDisp2##ID##) ; \
ATLASSERT( SUCCEEDED( hr##ID## ) ) ; \
vtIcon2##ID## =CComVariant (pPictureDisp2##ID##) ; \
} \
LPOLESTR ppsz =NULL ; \
hr##ID## =::StringFromCLSID (clientID, &ppsz) ; \
ATLASSERT( SUCCEEDED( hr##ID## ) ) ; \
hr##ID## =pControlDefs##ID##->AddButtonDefinition (CComBSTR (dispName),
CComBSTR (internalName), (CommandTypesEnum)(cmdType), CComVariant(ppsz),
CComBSTR (desc), CComBSTR (tooltip), vtIcon1##ID##, vtIcon2##ID##,
(ButtonDisplayEnum)(cmdDisplayType), &m_##name##Cmd) ; \
::CoTaskMemFree (ppsz) ; \
ATLASSERT( SUCCEEDED( hr##ID## ) ) ; \
hr##ID## =m_##name##Cmd->put_Enabled (enabled ? VARIANT_TRUE :
VARIANT_FALSE) ; \
ATLASSERT( SUCCEEDED( hr##ID## ) ) ; \
hr##ID## =CComObject::CreateInstance
(&m_##name##Hdlr) ; \
ATLASSERT( SUCCEEDED( hr##ID## ) && m_##name##Hdlr != NULL ) ; \
m_##name##Hdlr->AddRef () ; \
m_##name##Hdlr->m_pAddInServer =this ; \
m_##name##Hdlr->m_nCommandID =ID ; \
hr##ID## =m_##name##Hdlr->DispEventAdvise (m_##name##Cmd) ; \
ATLASSERT( SUCCEEDED( hr##ID## ) ) ; \
if ( hIcon != -1 ) { \
::DestroyIcon (h1##ID##) ; \
::DestroyIcon (h2##ID##) ; \
} \
}

-Venkatesh Thiyagarajan
Autodesk Inc.

wrote in message news:4852842@discussion.autodesk.com...
I am facing the same problem you mentioned above , and I cannot understand
how to fix it even after seeing your solution below, Could you please expain
it in more detail?
Thank you very much!
--------------------------------------------
I got the work-around. In the macro there is a parameter ID. So I replace
all the variable which are redifined by
VARIABLE##ID##.
0 Likes
Message 10 of 10

Anonymous
Not applicable
thank you very much!
0 Likes