Open-Document

Opens the specified document in a registered powerJobs application

Open-Document -LocalFile <string> [-Application <string>] [-Options <HashTable/string>] [<CommonParameters>]

Type Name Description Optional
String LocalFile The path to the document that should be openedno
String Application Can be used to force opening the document with the required application (see the names here). Otherwise a valid provider will be automatically detectedyes
HashTable / String Options The application will open the document with this optionsyes

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

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 Inventor and InventorServer the project file can be specified: @{'Project'='C:\temp\test.ipj'}
Additionally the API options of the mehtod OpenWithOptions can be used, eg: @{'Fast Open'=$true;“LevelOfDetailRepresentation'='Master'}

Type Name Description Default
string / System.IO.FileInfoProjectThe ProjectFile that Inventor uses to open the document. Possible: 'C:\somefile.ipj', [file]'C:\somefile.Ipj'Current Inventor Project
bool / stringVisible Specifies whether the document should be opened visible or invisible. Possible: $true,'False','TRUE'True
stringDesignViewRepresentation Only for assemblies and parts For assemblies the first DesignViewRepresentations of the document
stringPositionalRepresentation
stringLevelOfDetailRepresentation Only for assemblies Last saved LevelOfDetailRepresentation of the document
boolDeferUpdates Only for drawings
FileVersionEnum FileVersionOption
boolImportNonInventorDwg False
stringPassword
boolSkipAllUnresolvedFiles False
boolFastOpen Only for drawings. Supported in Inventor versions >= 2015False
ExpressModeBehaviorExpressModeBehavior Only for assemblies

DWG TrueView

DWG TrueView has less options, see the table below.

Type Name Description Default
bool / stringReadonly Specifies wether the document should be opened in readonly mode or not. Possible: $true,'False','TRUE'False

Opening an AutoCad dwg file

Open-Document -LocalFile 'C:\Vault\AutoCad\Test.dwg'

Opening an inventor drawing with FastOpen and correct project file

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

Open-Document -Application InventorServer -LocalFile 'C:\Vault\Inventor\Drawings\Footer.idw'

Validating if document was opened correctly

$result = Open-Document C:\Temp\Test.ipt
if(-not $result) {
 throw "Failed with error: ". $result.Error.Message
}

Using the open result

$result = Open-Document C:\Temp\Test.ipt

if($result.Application.Name -eq 'Inventor') {
  $result.Application.Instance.Visible=$true
  $result.Document.Instance ......
}