GUID of Factory Design Utilities

GUID of Factory Design Utilities

gert-leonvanlier
Collaborator Collaborator
639 Views
2 Replies
Message 1 of 3

GUID of Factory Design Utilities

gert-leonvanlier
Collaborator
Collaborator

I am looking for the GUID of Factory Design Utilities. I need to check if the current assemlby is a fatory layout for my addin, but I don't know where or how to find it. Or maybe there is another option to this check? I am open to all ideas and suggestions.

0 Likes
Accepted solutions (1)
640 Views
2 Replies
Replies (2)
Message 2 of 3

cidhelp
Advocate
Advocate
Accepted solution

Hi,

you can check the DocumentInterests of the assembly-document. If there is a DocumentInterest with the name 'factory.filetype.factory_layout_template' this should be a factory layout. If there is a DocumentInterest named 'factory.filetype.factory_asset' the document is an asset.

Here my VBA:

Sub CheckFactoryType()
   Dim oD As Document
   Set oD = ThisApplication.ActiveDocument
   Dim oDocInterest As DocumentInterest
   For Each oDocInterest In oD.DocumentInterests
      If Left(oDocInterest.Name, Len("factory")) = "factory" Then
         Debug.Print "This is an " & oDocInterest.Name
      End If
   Next
End Sub

 

Message 3 of 3

gert-leonvanlier
Collaborator
Collaborator

Yes! That works! Thank you very much.

 

I am writing in c#. This is my code:

public bool checkFactory()
        {
            string progId = "Inventor.Application";
            Type inventorApplicationType = Type.GetTypeFromProgID(progId);

            Inventor.Application invApp = (Inventor.Application)Marshal.GetActiveObject(progId);

            //Get the active document in Inventor
            Document oDoc = (Document)invApp.ActiveDocument;

            //string to find
            string str = "factory";

            //value to return
            bool returnValue;

            foreach (DocumentInterest oDocInterest in oDoc.DocumentInterests)
            {
                try
                {
                    if (oDocInterest.Name.Substring(0, str.Length) == "factory")
                    {
                        returnValue = true;
                    }
                    else
                    {
                        returnValue = false;
                    }
                }
                catch
                {
                    returnValue = false;
                }

                return returnValue;

            }
            return true;

        }
0 Likes