Document
A Document object is of type PSObject and represents an Inventor document.
In addition to selected Inventor API: Document properties, it provides direct access to the document’s iProperties, which can be read and modified.
Syntax
$document.FullFileName
$document.Title = 'Gearbox housing'
Following properties are always available :
Type |
Name |
Description |
Access type |
|---|---|---|---|
String |
FullFileName |
Complete path and file name. Empty if the document hasn’t been saved. |
read-only |
String |
FileName |
Document display name. |
? |
Boolean |
IsModifiable |
read-only |
Remarks
The $document object provides direct access to all iProperties across all of the document’s property sets.
This includes standard property sets such as Inventor Summary Information, Inventor Document Summary Information and Design Tracking Properties,
as well as Inventor User Defined Properties and custom property sets created by add-ins.
Content Center parts have additional iProperties available through the Content Library Component Properties and Content Library property sets.
All these iProperties can be accessed using the same names as in Inventor, including spaces. Property names containing spaces must therefore be enclosed in quotes.
Because PowerShell members are case-insensitive, the exact capitalization does not matter.
The document object supports all Inventor languages:
All iProperties can be accessed via their display name, which is localized and depends on the Inventor language (e.g.
Estimated Cost,Geschätzte Kosten)The iProperties from Standard property sets can be accessed via their system name with a leading underscore, which is not localized and the same in all Inventor languages (e.g.
_Cost)
Duplicate property names do not occur within standard property sets. And the ‘Inventor User Defined Properties’ (or ‘Custom’) property set is empty by default.
However, users can create custom properties with names that already exist in other property sets:
If a user-defined property has the same display name as a one from a standard property set (even if it differs only in upper and lower case), it is directly accessible on the$documentinstead of the standard one. To access the standard property, use its system name with a leading underscore.Add-ins may also create custom property sets containing iProperties with names that duplicate existing properties in other property sets::
The property that Inventor returns first, is available on$document. Other custom-properties with the same name are not accessible through$document, and a warning is logged.
Note
Therefore, it is recommended to use the system names when accessing properties from standard property sets. This ensures scripts work across different Inventor languages and avoids potential conflicts with custom properties.
Depending on the iProperty’s data type, its value is returned as the corresponding PowerShell data type or as a COM object.
For example, a Text property is returned as a string, a Number as a double, and a Date as a DateTime.
Setting a property modifies the value of the corresponding iProperty in the Inventor document. This change can be persisted by saving the document.
For an example of modifying a property in a SaveDocument_Pre event, see Register-InventorEvent.
Any errors caused by the underlying COM property assignment are replaced with clear, easy-to-understand error messages.
Examples
Accessing Cost for different Inventor languages
1 2 3 | $document."Estimated Cost" #can be used with English Inventor $document."Geschätzte Kosten" #can be used with German Inventor $document._Cost #can be used with all Inventor language environments |
Accessing Standard and Custom iProperties (despite duplicated names)
1 2 3 4 5 6 7 8 9 10 | # Design Tracking Properties: Part Number = 1000 # Inventor User Defined Properties: Part Number = A-1000 $document."Part Number" # A-1000 $document."_Part Number" # 1000 # Inventor User Defined Properties: Thickness = Plate, THICKNESS = Imperial # Custom Property Set: thickness = Heavy plate $document.Thickness # Plate (found first) $document.THICKNESS # Plate (same member) $document.THICKNESS = "Steel" # sets Thickness in Inventor User Defined Properties |
Document object on an English environment:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | _Appearance : _Author : Autodesk, Inc. _Authority : _Catalog Web Link : _Categories : _Category : _Checked By : _Comments : _Company : Autodesk, Inc. _Cost : 0.0000 _Cost Center : _Creation Time : 11/07/2001 00:00:00 _Date Checked : 01/01/1601 00:00:00 _Defer Updates : False _Density : 7.333267200572011 _Description : _Design Status : 1 _Designer : Autodesk, Inc. _Document SubType : {E60F81E1-49B3-11D0-93C3-7E0706000000} _Document SubType Name : Assembly _Engineer : _Engr Approved By : _Engr Date Approved : 01/01/1601 00:00:00 _External Property Revision Id : {A1306930-7E55-4F56-912F-973A7762DFAF} _Flat Pattern Area : 0 _Flat Pattern Defer Update : False _Flat Pattern Length : 0 _Flat Pattern Width : 0 _Keywords : _Language : _Last Saved By : _Last Updated With : 2027.1 (Build 311270010, 270A) _Manager : _Manufacturer : _Mass : 52.33436596220094 _Material : _Material Identifier : _Mfg Approved By : _Mfg Date Approved : 01/01/1601 00:00:00 _Parameterized Template : False _Part Icon : _Part Number : Tuner2 _Part Property Revision Id : {F943F86A-39B7-4326-8A24-26765D919F5B} _Project : _Proxy Refresh Date : 01/01/1601 00:00:00 _Revision Number : _Revit Category : 0 _Sheet Metal Area : _Sheet Metal Length : _Sheet Metal Rule : _Sheet Metal Width : _Size Designation : _Standard : _Standard Revision : _Standards Organization : _Stock Number : _Subject : _SurfaceArea : 86.62605404758622 _Template Row : _Thumbnail : System.__ComObject _Title : _User Status : _Valid MassProps : 1 _Vendor : _Volume : 7.13656880770944 _Weld Material : Appearance : Area : 86.62605404758622 Author : Autodesk, Inc. Authority : Categories : Category : Checked By : Checked Date : 01/01/1601 00:00:00 Comments : Company : Autodesk, Inc. Cost Center : Creation Date : 11/07/2001 00:00:00 Date proxy refreshed : 01/01/1601 00:00:00 Defer Updates : False Density : 7.333267200572011 Description : Design State : 1 Designer : Autodesk, Inc. Eng. Approved By : Eng. Approved Date : 01/01/1601 00:00:00 Engineer : Estimated Cost : 0.0000 External Part Revision : {A1306930-7E55-4F56-912F-973A7762DFAF} FileName : Tuner.iam Flat Pattern Defer Update : False Flat Pattern Extents Width : 0 Flat PatternExtents Area : 0 FlatPatternExtentsLength : 0 FullFileName : C:\Users\Manuel\Documents\Vault\Designs\Samples\Models\Assemblies\Tuner\Tuner.iam IsModifiable : True Keywords : Language : Last Saved By : Last Update with : 2027.1 (Build 311270010, 270A) Manager : Manufacturer : Mass : 52.33436596220094 Material : Material Identifier : Mfg. Approved By : Mfg. Approved Date : 01/01/1601 00:00:00 Parameterized Template : False Part Icon : Part Number : Tuner2 Part Revision : {F943F86A-39B7-4326-8A24-26765D919F5B} Part Type : {E60F81E1-49B3-11D0-93C3-7E0706000000} Part Type name : Assembly Project : Revision Number : Revit Category : 0 Sheet Metal Area : Sheet Metal Length : Sheet Metal Width : SheetMetalRule : Size Designation : Standard : Standard Revision : Standards Organization : Status : Stock Number : Subject : Template Row : Thumbnail : System.__ComObject Title : Valid MassProps : 1 Vendor : Volume : 7.13656880770944 Web Link : Weld Material : |
Additional properties of Content Center parts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | _Component Type : 0 _Family : [CPLG, NPT STANDARD, STEEL] _Family Folder : [CPLG, NPT STANDARD, STEEL] _Family Revision : e9b8f859-eedb-4d73-ad9a-0f474a175812 _Family Revision Time : 07/04/2014 20:45:54 _FamilyId : 1e0e8ebe-c7e3-4f47-b324-42da6f01951b _IsCustomPart : 0 _Member : _Member FileName : HALF COUPLING, 0.375 NPT STANDARD, STEEL _Member Revision : 604695dd-8409-4c95-82c0-573c46276b5b _MemberId : c598a800-b6c4-4133-a868-d15cc342e2d5 Family : [CPLG, NPT STANDARD, STEEL] Family Folder : [CPLG, NPT STANDARD, STEEL] Family Revision : e9b8f859-eedb-4d73-ad9a-0f474a175812 Family Revision Time : 07/04/2014 20:45:54 FamilyId : 1e0e8ebe-c7e3-4f47-b324-42da6f01951b IsCustomPart : 0 Member FileName : HALF COUPLING, 0.375 NPT STANDARD, STEEL MemberId : c598a800-b6c4-4133-a868-d15cc342e2d5 |