Show / Hide Table of Contents

Class ParameterShim

A set of methods to interact with Document Parameters in a more intuitive way. They will tend to fail more gracefully than the built-in parameter manipulation methods. For example, if you attempt to set the value of a parameter that does not exist in the document, that parameter is created instead of throwing an exception and crashing your code if you don't handle it.

Inheritance
System.Object
ParameterShim
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: InventorShims
Assembly: InventorShims.dll
Syntax
public static class ParameterShim

Methods

| Improve this Doc View Source

EnumerateParameterNames(Parameters)

Return a list of parameter names within the specified Parameters object.

Declaration
public static IEnumerable<string> EnumerateParameterNames(Parameters parameters)
Parameters
Type Name Description
Inventor.Parameters parameters
Returns
Type Description
System.Collections.Generic.IEnumerable<System.String>

List (of string)

| Improve this Doc View Source

EnumerateParameters(AssemblyDocument)

Enumerate all parameter objects in a provided AssemblyDocument object as IEnumerable{Parameter}

Declaration
public static IEnumerable<Parameter> EnumerateParameters(this AssemblyDocument document)
Parameters
Type Name Description
Inventor.AssemblyDocument document
Returns
Type Description
System.Collections.Generic.IEnumerable<Inventor.Parameter>
| Improve this Doc View Source

EnumerateParameters(Document)

Enumerate all parameter objects in a provided Document object as IEnumerable{Parameter}

Declaration
public static IEnumerable<Parameter> EnumerateParameters(this Document document)
Parameters
Type Name Description
Inventor.Document document
Returns
Type Description
System.Collections.Generic.IEnumerable<Inventor.Parameter>
| Improve this Doc View Source

EnumerateParameters(DrawingDocument)

Enumerate all parameter objects in a provided DrawingDocument object as IEnumerable{Parameter}

Declaration
public static IEnumerable<Parameter> EnumerateParameters(this DrawingDocument document)
Parameters
Type Name Description
Inventor.DrawingDocument document
Returns
Type Description
System.Collections.Generic.IEnumerable<Inventor.Parameter>
| Improve this Doc View Source

EnumerateParameters(PartDocument)

Enumerate all parameter objects in a provided PartDocument object as IEnumerable{Parameter}

Declaration
public static IEnumerable<Parameter> EnumerateParameters(this PartDocument document)
Parameters
Type Name Description
Inventor.PartDocument document
Returns
Type Description
System.Collections.Generic.IEnumerable<Inventor.Parameter>
| Improve this Doc View Source

GetParameter(AssemblyDocument, String)

Returns a parameter object from an AssemblyDocument object specified by name.


VB sample:
Dim oParameter As Parameter = GetParameter(oAssemblyDoc, "ParameterName")
Declaration
public static Parameter GetParameter(this AssemblyDocument document, string parameterName)
Parameters
Type Name Description
Inventor.AssemblyDocument document
System.String parameterName
Returns
Type Description
Inventor.Parameter
| Improve this Doc View Source

GetParameter(Document, String)

Returns a parameter object from a document object specified by name.


VB sample:
Dim oParameter As Parameter = GetParameter(oDoc, "ParameterName")
Declaration
public static Parameter GetParameter(this Document document, string parameterName)
Parameters
Type Name Description
Inventor.Document document

Inventor.Document

System.String parameterName
Returns
Type Description
Inventor.Parameter

Parameter

| Improve this Doc View Source

GetParameter(DrawingDocument, String)

Returns a parameter object from a DrawingDocument object specified by name.


VB sample:
Dim oParameter As Parameter = GetParameter(oDrawingDoc, "ParameterName")
Declaration
public static Parameter GetParameter(this DrawingDocument document, string parameterName)
Parameters
Type Name Description
Inventor.DrawingDocument document
System.String parameterName
Returns
Type Description
Inventor.Parameter
| Improve this Doc View Source

GetParameter(PartDocument, String)

Returns a parameter object from a PartDocument object specified by name.


VB sample:
Dim oParameter As Parameter = GetParameter(oPartDoc, "ParameterName")
Declaration
public static Parameter GetParameter(this PartDocument document, string parameterName)
Parameters
Type Name Description
Inventor.PartDocument document
System.String parameterName
Returns
Type Description
Inventor.Parameter
| Improve this Doc View Source

GetParameterNames(AssemblyDocument)

Return a list of parameter names within the specified AssemblyDocument.

Declaration
public static List<string> GetParameterNames(this AssemblyDocument document)
Parameters
Type Name Description
Inventor.AssemblyDocument document
Returns
Type Description
System.Collections.Generic.List<System.String>

List (of string)

| Improve this Doc View Source

GetParameterNames(Document)

Return a list of parameter names within the specified Document.

Declaration
public static List<string> GetParameterNames(this Document document)
Parameters
Type Name Description
Inventor.Document document

Inventor.Document

Returns
Type Description
System.Collections.Generic.List<System.String>

List (of string)

| Improve this Doc View Source

GetParameterNames(DrawingDocument)

Return a list of parameter names within the specified DrawingDocument.

Declaration
public static List<string> GetParameterNames(this DrawingDocument document)
Parameters
Type Name Description
Inventor.DrawingDocument document
Returns
Type Description
System.Collections.Generic.List<System.String>

List (of string)

| Improve this Doc View Source

GetParameterNames(PartDocument)

Return a list of parameter names within the specified PartDocument.

Declaration
public static List<string> GetParameterNames(this PartDocument document)
Parameters
Type Name Description
Inventor.PartDocument document
Returns
Type Description
System.Collections.Generic.List<System.String>

List (of string)

| Improve this Doc View Source

GetParameters(AssemblyDocument)

Returns the Parameters object in a specified AssemblyDocument object.


VB sample:
Dim oParams As Parameters = GetParameters(oAssemblyDoc)
Declaration
public static Parameters GetParameters(this AssemblyDocument document)
Parameters
Type Name Description
Inventor.AssemblyDocument document
Returns
Type Description
Inventor.Parameters
| Improve this Doc View Source

GetParameters(Document)

Returns the Parameters object in a specified Document object.


VB sample:
Dim oParams As Parameters = GetParameters(oDoc)
Declaration
public static Parameters GetParameters(this Document document)
Parameters
Type Name Description
Inventor.Document document

Inventor.Document

Returns
Type Description
Inventor.Parameters

Parameters

| Improve this Doc View Source

GetParameters(DrawingDocument)

Returns the Parameters object in a specified DrawingDocument object.


VB sample:
Dim oParams As Parameters = GetParameters(oDrawingDoc)
Declaration
public static Parameters GetParameters(this DrawingDocument document)
Parameters
Type Name Description
Inventor.DrawingDocument document
Returns
Type Description
Inventor.Parameters
| Improve this Doc View Source

GetParameters(PartDocument)

Returns the Parameters object in a specified PartDocument object.


VB sample:
Dim oParams As Parameters = GetParameters(oPartDoc)
Declaration
public static Parameters GetParameters(this PartDocument document)
Parameters
Type Name Description
Inventor.PartDocument document
Returns
Type Description
Inventor.Parameters
| Improve this Doc View Source

GetParameterValue(AssemblyDocument, String)

Gets the value of a numeric parameter.


VB sample:
Msgbox(GetParameterValue(oAssemblyDoc, "ParameterName"))
Declaration
public static string GetParameterValue(this AssemblyDocument document, string parameterName)
Parameters
Type Name Description
Inventor.AssemblyDocument document
System.String parameterName
Returns
Type Description
System.String
| Improve this Doc View Source

GetParameterValue(Document, String)

Gets the value of a numeric parameter.


VB sample:
Msgbox(GetParameterValue(oDoc, "ParameterName"))
Declaration
public static string GetParameterValue(this Document document, string parameterName)
Parameters
Type Name Description
Inventor.Document document

Inventor.Document

System.String parameterName

Name of the parameter as a string.

Returns
Type Description
System.String
| Improve this Doc View Source

GetParameterValue(DrawingDocument, String)

Gets the value of a numeric parameter.


VB sample:
Msgbox(GetParameterValue(oDrawingDoc, "ParameterName"))
Declaration
public static string GetParameterValue(this DrawingDocument document, string parameterName)
Parameters
Type Name Description
Inventor.DrawingDocument document
System.String parameterName
Returns
Type Description
System.String
| Improve this Doc View Source

GetParameterValue(PartDocument, String)

Gets the value of a numeric parameter.


VB sample:
Msgbox(GetParameterValue(oPartDoc, "ParameterName"))
Declaration
public static string GetParameterValue(this PartDocument document, string parameterName)
Parameters
Type Name Description
Inventor.PartDocument document
System.String parameterName
Returns
Type Description
System.String
| Improve this Doc View Source

ParameterIsWritable(AssemblyDocument, String)

Tests if the parameter matching the provided parameterName is writable. Only kModelParameters and kUserParameters return true.


VB sample:
Dim answer As Boolean = ParameterIsWritable(oAssemblyDoc, "ThisParameterName")
Declaration
public static bool ParameterIsWritable(AssemblyDocument document, string parameterName)
Parameters
Type Name Description
Inventor.AssemblyDocument document
System.String parameterName
Returns
Type Description
System.Boolean
| Improve this Doc View Source

ParameterIsWritable(Document, String)

Tests if the parameter matching the provided parameterName is writable. Only kModelParameters and kUserParameters return true.


VB sample:
Dim answer As Boolean = ParameterIsWritable(oDoc, "ThisParameterName")
Declaration
public static bool ParameterIsWritable(Document document, string parameterName)
Parameters
Type Name Description
Inventor.Document document

Document

System.String parameterName

String

Returns
Type Description
System.Boolean

Boolean

| Improve this Doc View Source

ParameterIsWritable(DrawingDocument, String)

Tests if the parameter matching the provided parameterName is writable. Only kModelParameters and kUserParameters return true.


VB sample:
Dim answer As Boolean = ParameterIsWritable(oDrawingDoc, "ThisParameterName")
Declaration
public static bool ParameterIsWritable(DrawingDocument document, string parameterName)
Parameters
Type Name Description
Inventor.DrawingDocument document
System.String parameterName
Returns
Type Description
System.Boolean
| Improve this Doc View Source

ParameterIsWritable(Parameter)

Tests if the provided parameter is writable. Only kModelParameters and kUserParameters return true.


VB sample:
Dim answer As Boolean = ParameterIsWritable(oParameter)
Declaration
public static bool ParameterIsWritable(this Parameter parameter)
Parameters
Type Name Description
Inventor.Parameter parameter

Parameter

Returns
Type Description
System.Boolean

Boolean

| Improve this Doc View Source

ParameterIsWritable(PartDocument, String)

Tests if the parameter matching the provided parameterName is writable. Only kModelParameters and kUserParameters return true.


VB sample:
Dim answer As Boolean = ParameterIsWritable(oPartDoc, "ThisParameterName")
Declaration
public static bool ParameterIsWritable(PartDocument document, string parameterName)
Parameters
Type Name Description
Inventor.PartDocument document
System.String parameterName
Returns
Type Description
System.Boolean
| Improve this Doc View Source

RemoveParameter(AssemblyDocument, String)

Removes a parameter from a Document object if it exists.


VB sample:
RemoveParameter(oAssemblyDoc, "ParameterName")
Declaration
public static void RemoveParameter(this AssemblyDocument document, string parameterName)
Parameters
Type Name Description
Inventor.AssemblyDocument document
System.String parameterName
| Improve this Doc View Source

RemoveParameter(Document, String)

Removes a parameter from a Document object if it exists.


VB sample:
RemoveParameter(oDoc, "ParameterName")
Declaration
public static void RemoveParameter(this Document document, string parameterName)
Parameters
Type Name Description
Inventor.Document document

Inventor.Document

System.String parameterName
| Improve this Doc View Source

RemoveParameter(DrawingDocument, String)

Removes a parameter from a Document object if it exists.


VB sample:
RemoveParameter(oDrawingDoc, "ParameterName")
Declaration
public static void RemoveParameter(this DrawingDocument document, string parameterName)
Parameters
Type Name Description
Inventor.DrawingDocument document
System.String parameterName
| Improve this Doc View Source

RemoveParameter(PartDocument, String)

Removes a parameter from a Document object if it exists.


VB sample:
RemoveParameter(oPartDoc, "ParameterName")
Declaration
public static void RemoveParameter(this PartDocument document, string parameterName)
Parameters
Type Name Description
Inventor.PartDocument document
System.String parameterName
| Improve this Doc View Source

SetParameterValue(AssemblyDocument, String, Boolean, Boolean)

Sets the value of a boolean parameter, or creates one if one does not exist.


VB sample:
SetParameterValue(oAssemblyDoc, "ParameterName", true))
Declaration
public static void SetParameterValue(this AssemblyDocument document, string parameterName, bool parameterValue, bool clobberFlag = true)
Parameters
Type Name Description
Inventor.AssemblyDocument document
System.String parameterName
System.Boolean parameterValue
System.Boolean clobberFlag

If set to false, will not overwrite an existing parameter.

| Improve this Doc View Source

SetParameterValue(AssemblyDocument, String, String, Boolean)

Sets the value of a text parameter, or creates one if one does not exist.


VB sample:
SetParameterValue(oAssemblyDoc, "ParameterName", "This is a text value!"))
Declaration
public static void SetParameterValue(this AssemblyDocument document, string parameterName, string parameterValue, bool clobberFlag = true)
Parameters
Type Name Description
Inventor.AssemblyDocument document
System.String parameterName
System.String parameterValue
System.Boolean clobberFlag

If set to false, will not overwrite an existing parameter.

| Improve this Doc View Source

SetParameterValue(AssemblyDocument, String, String, String, Boolean)

Sets the value of a numeric parameter, or creates one if one does not exist.


VB sample:
SetParameterValue(oAssemblyDoc, "ParameterName", 42, "in"))
Declaration
public static void SetParameterValue(this AssemblyDocument document, string parameterName, string parameterValue, string units, bool clobberFlag = true)
Parameters
Type Name Description
Inventor.AssemblyDocument document
System.String parameterName
System.String parameterValue
System.String units
System.Boolean clobberFlag

If set to false, will not overwrite an existing parameter.

| Improve this Doc View Source

SetParameterValue(Document, String, Boolean, Boolean)

Sets the value of a boolean parameter, or creates one if one does not exist.


VB sample:
SetParameterValue(oDoc, "ParameterName", true))
Declaration
public static void SetParameterValue(this Document document, string parameterName, bool parameterValue, bool clobberFlag = true)
Parameters
Type Name Description
Inventor.Document document

Inventor.Document

System.String parameterName
System.Boolean parameterValue
System.Boolean clobberFlag

If set to false, will not overwrite an existing parameter.

| Improve this Doc View Source

SetParameterValue(Document, String, String, Boolean)

Sets the value of a text parameter, or creates one if one does not exist.


VB sample:
SetParameterValue(oDoc, "ParameterName", "This is a text value!"))
Declaration
public static void SetParameterValue(this Document document, string parameterName, string parameterValue, bool clobberFlag = true)
Parameters
Type Name Description
Inventor.Document document

Inventor.Document

System.String parameterName
System.String parameterValue
System.Boolean clobberFlag

If set to false, will not overwrite an existing parameter.

| Improve this Doc View Source

SetParameterValue(Document, String, String, String, Boolean)

Sets the value of a numeric parameter, or creates one if one does not exist.


VB sample:
SetParameterValue(oDoc, "ParameterName", 42, "in"))
Declaration
public static void SetParameterValue(this Document document, string parameterName, string parameterValue, string units, bool clobberFlag = true)
Parameters
Type Name Description
Inventor.Document document

Inventor.Document

System.String parameterName
System.String parameterValue
System.String units

Units as a string, e.g. in, mm, cm, etc

System.Boolean clobberFlag

If set to false, will not overwrite an existing parameter.

| Improve this Doc View Source

SetParameterValue(DrawingDocument, String, Boolean, Boolean)

Sets the value of a boolean parameter, or creates one if one does not exist.


VB sample:
SetParameterValue(oDrawingDoc, "ParameterName", true))
Declaration
public static void SetParameterValue(this DrawingDocument document, string parameterName, bool parameterValue, bool clobberFlag = true)
Parameters
Type Name Description
Inventor.DrawingDocument document
System.String parameterName
System.Boolean parameterValue
System.Boolean clobberFlag

If set to false, will not overwrite an existing parameter.

| Improve this Doc View Source

SetParameterValue(DrawingDocument, String, String, Boolean)

Sets the value of a text parameter, or creates one if one does not exist.


VB sample:
SetParameterValue(oDrawingDoc, "ParameterName", "This is a text value!"))
Declaration
public static void SetParameterValue(this DrawingDocument document, string parameterName, string parameterValue, bool clobberFlag = true)
Parameters
Type Name Description
Inventor.DrawingDocument document
System.String parameterName
System.String parameterValue
System.Boolean clobberFlag
| Improve this Doc View Source

SetParameterValue(DrawingDocument, String, String, String, Boolean)

Sets the value of a numeric parameter, or creates one if one does not exist.


VB sample:
SetParameterValue(oDrawingDoc, "ParameterName", 42, "in"))
Declaration
public static void SetParameterValue(this DrawingDocument document, string parameterName, string parameterValue, string units, bool clobberFlag = true)
Parameters
Type Name Description
Inventor.DrawingDocument document
System.String parameterName
System.String parameterValue
System.String units
System.Boolean clobberFlag

If set to false, will not overwrite an existing parameter.

| Improve this Doc View Source

SetParameterValue(PartDocument, String, Boolean, Boolean)

Sets the value of a boolean parameter, or creates one if one does not exist.


VB sample:
SetParameterValue(oPartDoc, "ParameterName", true))
Declaration
public static void SetParameterValue(this PartDocument document, string parameterName, bool parameterValue, bool clobberFlag = true)
Parameters
Type Name Description
Inventor.PartDocument document
System.String parameterName
System.Boolean parameterValue
System.Boolean clobberFlag

If set to false, will not overwrite an existing parameter.

| Improve this Doc View Source

SetParameterValue(PartDocument, String, String, Boolean)

Sets the value of a text parameter, or creates one if one does not exist.


VB sample:
SetParameterValue(oPartDoc, "ParameterName", "This is a text value!"))
Declaration
public static void SetParameterValue(this PartDocument document, string parameterName, string parameterValue, bool clobberFlag = true)
Parameters
Type Name Description
Inventor.PartDocument document
System.String parameterName
System.String parameterValue
System.Boolean clobberFlag

If set to false, will not overwrite an existing parameter.

| Improve this Doc View Source

SetParameterValue(PartDocument, String, String, String, Boolean)

Sets the value of a numeric parameter, or creates one if one does not exist.


VB sample:
SetParameterValue(oPartDoc, "ParameterName", 42, "in"))
Declaration
public static void SetParameterValue(this PartDocument document, string parameterName, string parameterValue, string units, bool clobberFlag = true)
Parameters
Type Name Description
Inventor.PartDocument document
System.String parameterName
System.String parameterValue
System.String units
System.Boolean clobberFlag

If set to false, will not overwrite an existing parameter.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX