How to set file icon in Inventor browser view

How to set file icon in Inventor browser view

Anonymous
Not applicable
685 Views
5 Replies
Message 1 of 6

How to set file icon in Inventor browser view

Anonymous
Not applicable

I want to set file icon, similar to when files are linked to vault and appears the status icon on the left of the file icon.

 

How can I do this?

 

Thanks & Regards,

Rui

0 Likes
686 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

Hi,

 

I created my own pane and everything works except that don’t shows the display status icon.

 

Here is my code:

 

   int li_pos = 0;
                 int count = 10;
                 BrowserPanes bps = avcl_docm.BrowserPanes;

                 System.Drawing.Icon icon = IconReader.GetFileIcon(avs_fileName, IconReader.IconSize.Small, false);
                 stdole.IPictureDisp m_IPictureDisp = AxHostConverter.ImageToPictureDisp(icon.ToBitmap());
                 Inventor.ClientNodeResource m_topNodeClientResource = bps.ClientNodeResources.Add("testRsc", count, m_IPictureDisp);

                 stdole.IPictureDisp[] m_IPictureDispStatus = 
                                             {         
                                                 AxHostConverter.ImageToPictureDisp( Properties.Resources.NewlyAddedStatus),
                                                 AxHostConverter.ImageToPictureDisp( Properties.Resources.CheckOutStatus),
                                                 AxHostConverter.ImageToPictureDisp( Properties.Resources.CheckInStatus)
                                             };
                 string[] ls_toolTipStatus = {"Newly added file", "Checked out", "Checked-in"};
                 Inventor.ClientNodeResource[] m_statusClientNodeResource = 
                                            {
                                                bps.ClientNodeResources.Add("testStatus0", 0, m_IPictureDispStatus[0]),
                                                bps.ClientNodeResources.Add("testStatus1", 1, m_IPictureDispStatus[1]),
                                                bps.ClientNodeResources.Add("testStatus2", 2, m_IPictureDispStatus[2]),
                                            };
                 
                 c_Document lcl_docm = new c_Document(AddinGlobal.CodValtId, AddinGlobal.SessionKey, AddinGlobal.CodAplcConcId, AddinGlobal.CodLicnUtlzId, AddinGlobal.CodUtlzId, avs_codDocmId);
                 DataSet ds_docm = lcl_docm.m_GetDocumentRelationships();

                 li_pos = 2;
                 if (!string.IsNullOrEmpty(m_IsFileNameCheckout(avs_fileName)))
                    li_pos = 1;

                 //Add Top Node
                 count = count + 1;
                 Inventor.ClientBrowserNodeDefinition m_topNodeDefinition = bps.CreateBrowserNodeDefinition(
                                                                                            avcl_docm.DisplayName, 
                                                                                            200 + count, 
                                                                                            m_topNodeClientResource, 
                                                                                            avcl_docm.FullDocumentName, 
                                                                                            m_topNodeClientResource, 
                                                                                            m_statusClientNodeResource[li_pos], 
                                                                                            ls_toolTipStatus[li_pos]);
                 Inventor.BrowserPane m_customBrowserPane = bps.AddTreeBrowserPane("My Test", "testBrowser", (Inventor.BrowserNodeDefinition)m_topNodeDefinition);

                 Inventor.ClientNodeResource m_childNodeClientResource = null;
                 Inventor.ClientBrowserNodeDefinition m_childNodeDefinition = null;
                 Inventor.BrowserNode m_childNode = null;

                 foreach (Inventor.DocumentDescriptor refDocument in avcl_docm.ReferencedDocumentDescriptors)
                 {
                     if (m_AlreadyInRelationships(ds_docm, c_File.m_GetFileName(refDocument.FullDocumentName)) == false)
                         li_pos = 0;
                     else if (!string.IsNullOrEmpty(m_IsFileNameCheckout(refDocument.FullDocumentName)))
                         li_pos = 1;
                     else
                         li_pos = 2;

                     count = count + 1;
                     icon = IconReader.GetFileIcon(refDocument.FullDocumentName, IconReader.IconSize.Small, false);
                     m_IPictureDisp = AxHostConverter.ImageToPictureDisp(icon.ToBitmap());
                     m_childNodeClientResource = bps.ClientNodeResources.Add("testRsc" + count.ToString(), count, m_IPictureDisp);
                     
                     //Add 1 Child Nodes.
                     m_childNodeDefinition = (Inventor.ClientBrowserNodeDefinition)bps.CreateBrowserNodeDefinition(
                                                                                                    refDocument.DisplayName, 
                                                                                                    200 + count, 
                                                                                                    m_childNodeClientResource, 
                                                                                                    refDocument.FullDocumentName, 
                                                                                                    m_childNodeClientResource, 
                                                                                                    m_statusClientNodeResource[li_pos], 
                                                                                                    ls_toolTipStatus[li_pos]);
                     m_childNode = m_customBrowserPane.TopNode.AddChild((Inventor.BrowserNodeDefinition)m_childNodeDefinition);
                 }
                 m_customBrowserPane.Activate();

 

 

What could be? 

 

Thanks & Regards,

Rui

0 Likes
Message 3 of 6

Anonymous
Not applicable

I already found an way to use state icons using the BrowserNodeDisplayStateEnum in CreateBrowserNodeDefinition function.

 

But this way I only can use the predefined state icons that Inventor provide in BrowserNodeDisplayStateEnum enumerator.

 

It is not possible customize the state icons with my own icons? Like do the Vault interface?

 

Thanks & Regards,

Rui

 

0 Likes
Message 4 of 6

wayne.brill
Collaborator
Collaborator

Hi Rui,

 

I am able to recreate the behavior.  I asked a colleague in Inventor Engineering about this. Here is an excerpt of their reply:

 

>> >>

Currently we can’t change the DisplayState and AdditionalDisplayState icons with custom icons.

<< <<

 

Please request this on the Inventor Idea Station:

http://forums.autodesk.com/t5/inventor-ideastation/idb-p/v1232/tab/most-recent

 

 

Thanks,

Wayne



Wayne Brill
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 5 of 6

Anonymous
Not applicable

Hi Wayne,

 

Thanks for the reply.

 

As I understood the icons that Vault use are different of the available in BrowserNodeDisplayStateEnum Enumerator. Right?

 

It is possible use the same icons that are showed in Vault browser view? If yes. How?

 

Thanks & Regards,

 

Rui

0 Likes
Message 6 of 6

wayne.brill
Collaborator
Collaborator

Hi Rui,

 

A colleague in Vault Engineering confirms that the Vault Add-In is not using the publicly available API to display those icons. Currently it is not possible to use the Vault icons for the DisplayState icons.

 

Thanks,

Wayne 

 



Wayne Brill
Developer Technical Services
Autodesk Developer Network

0 Likes