# Open-Document Opens the specified document in a registered powerJobs Processor {doc}`/jobprocessor/applications`. ## Syntax ```{code-block} PowerShell :linenos: Open-Document -LocalFile [-Application ] [-Options ] [] ``` ## Parameters | Type | Name | Description | Optional | | ------------------ | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | | String | LocalFile | The path to the document that should be opened | no | | String | Application | Can be used to force opening the document with a specific {ref}`application `. Otherwise a valid provider will be automatically detected | yes | | HashTable / String | Options | The application will open the document with this options | yes | ## Return type **Bool**: on success the cmdlet returns \$true otherwise \$false.\ \$result.Error \<- The result has additionally an Error property which contains the Exception object\ \$result.Application \<- Application is an implementation of IApplication\ \$result.Document \<- Document is an implementation of IDocument ## Remarks Depending on the application that opens the document, application specific default options will be used. To check with which options the document was really opened, just take the \$result.Document.OpenSettings which contains all the properties that where used for the opening.\ These are the possible open **Options** for the default application: ### Inventor / InventorServer For {ref}`Inventor ` and {ref}`InventorServer ` the project file can be specified via `@{'Project'='C:\temp\test.ipj'}`.\ Additionally all the options of the API method [OpenWithOptions](https://help.autodesk.com/view/INVNTOR/2020/ENU/?guid=GUID-44DDD7C9-D90E-4F49-BEE2-757EE785C826) can be used, eg `@{'Fast Open'=$true; 'LevelOfDetailRepresentation'='Master'}`: | Type | Name | Description | Default | | --------------------------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------- | | string / System.IO.FileInfo | Project | The ProjectFile that Inventor uses to open the document. Possible: `'C:\somefile.ipj'`, `[file]'C:\somefile.Ipj'` | Current Inventor Project | | bool / string | Visible | Specifies whether the document should be opened visible or invisible. Possible: `$true`,`'False'`,`'TRUE'` | True | | string | DesignViewRepresentation | Only for assemblies and parts | For assemblies the first DesignViewRepresentations of the document | | string | PositionalRepresentation | Only for assemblies | | | string | LevelOfDetailRepresentation | Only for assemblies. Supported in Inventor versions 2021 and earlier | Last saved LevelOfDetailRepresentation of the document, e.g. 'Master' | | string | ModelState | Only for assemblies and parts. Supported in Inventor version 2022 | The 'Master' model state | | bool | DeferUpdates | Only for drawings | | | FileVersionEnum | FileVersionOption | | | | bool | ImportNonInventorDwg | | False | | string | Password | | | | ExpressModeBehavior | ExpressModeBehavior | Only for assemblies | | | bool | SkipAllUnresolvedFiles | | False | | bool | DeferFlatPatternUpdate | Only for sheet metal parts | False | | bool | FastOpen | Only for drawings | False | ### DWG TrueView {ref}`DWG TrueView ` has only the following options: | Type | Name | Description | Default | | ------------- | -------- | ------------------------------------------------------------------------------------------------------ | ------- | | bool / string | Readonly | Specifies wether the document should be opened in readonly mode or not. Possible: `$true`,`'False'`,`'TRUE'` | False | ## Examples **Opening an AutoCad dwg file** ```{code-block} PowerShell :linenos: Open-Document -LocalFile 'C:\Vault\AutoCad\Test.dwg' ``` **Opening an inventor drawing with FastOpen and correct project file** ```{code-block} PowerShell :linenos: Open-Document -LocalFile 'C:\Vault\Inventor\PadLock\Pad Lock.idw' -Options @{ 'Project'='C:\Vault\Default.ipj'; 'FastOpen'=$true } ``` **Forcing InventorServer to open a Inventor drawing** ```{code-block} PowerShell :linenos: Open-Document -Application InventorServer -LocalFile 'C:\Vault\Inventor\Drawings\Footer.idw' ``` **Validating if document was opened correctly** ```{code-block} PowerShell :linenos: $result = Open-Document C:\Temp\Test.ipt if(-not $result) { throw "Failed with error: ". $result.Error.Message } ``` **Using the open result** ```{code-block} PowerShell :linenos: $result = Open-Document C:\Temp\Test.ipt if($result.Application.Name -eq 'Inventor') { $result.Application.Instance.Visible=$true $result.Document.Instance #... } ```