Issue
I set DesignViewAssociative in an option for Documents.OpenWithOptions. But OpenWithOptions failed.
Solution
DesignViewAssociative does not support with Documents.Open. But you can still control the option by
- AssemblyOptions. DefaultDesignViewIsAssociative (Inventor 2010 and before)
– FileOpenOptions. DefaultDesignViewIsAssociative (Inventor 2011)
static void Test() { // assume we have had Inventor application // Create a new NameValueMap object NameValueMap oDocOpenOptions = _InvApplication.TransientObjects.CreateNameValueMap(); // Set the representations to use when opening the document. oDocOpenOptions.Add( "LevelOfDetailRepresentation", "MyLODRep"); oDocOpenOptions.Add( "PositionalRepresentation", "MyPositionalRep"); oDocOpenOptions.Add( "DesignViewRepresentation", "MyDesignViewRep"); // oDocOpenOptions.Add( "DefaultDesignViewIsAssociative", false); FileOpenOptions oFileOp = _InvApplication.FileOptions.FileOpenOptions; if (oFileOp.DefaultDesignView == DesignViewTypeEnum.kLastActiveDesignViewType) { // This property is only applicable if the default // design view is 'Last Active' as indicated by the //DefaultDesignView property // returning kLastActiveDesignViewType. If the default // design view is any other value, then this property is // not applicable and setting it will fail. oFileOp.DefaultDesignViewIsAssociative = false; } // Open the document. AssemblyDocument oDoc = (AssemblyDocument)_InvApplication.Documents.OpenWithOptions( @"C:Temptest.iam", oDocOpenOptions, true); }

Leave a Reply