iPropertyGroups

A library for Autodesk Inventor that lets you manage user-defined groups of iProperties.

What does it do?

Lets say you have a group of iProperties that you want to apply to various Inventor files. Typically you'd hard-code a bunch of iProperties and default expressions/values into your code. Then you'd write custom logic to manage and apply these to documents.

This library takes most of that management drudgery out of your hands. You can define a group of iProperties into an PropertyGroup object. The PropertyGroup objects are a dictionaries of simple strings with some extra methods. If you have multiple PropertyGroup objects, they can be managed from an PropertyGroups object. You can load PropertyGroups objects from json files.

This library will not do any checks against what documents are suitable to be modified (e.g. content center files, library files, etc).

Getting Started

First off, you'll want to download or build a copy of the iPropertyGroups.dll file. There are several options available:

  1. Include the iPropertyGroups nuget package in your .net project.
  2. Visit the Releases page and download the compiled iPropertyGroups.dll and reference it in your Inventor iLogic or add-in code.
  3. Clone this repo and building the dll yourself.
  4. Copy out the methods, classes, or modules that are useful and include those in your own code.
  5. Use the code in this package as reference material.

How to Use

  • For iLogic, add the following code in your iLogic rule header:

    AddReference "iPropertyGroups.dll"
    Imports iPropertyGroups
    
    'Add your code here, include iPropertyGroups API functions as you need...
    
  • For add-in development, add the iPropertyGroups.dll as a reference to your project.

  • Visit the samples/ folder for iLogic rule examples.

  • Here is a simple iLogic rule showing the library in use:

    AddReference "iPropertyGroups.dll"
    Imports iPropertyGroups
    
    'Create a PropertyGroups object and load a json file into the object.
    Dim oGroups As PropertyGroups = PropertyGroups.LoadJson("C:\Path\to\your\propertygroups-definition.json")
    
    'Get active document object...
    Dim oDoc As Inventor.Document = ThisApplication.ActiveDocument
    
    'Apply PropertyGroups object to the document...
    oGroups.Item("Stock Part").ApplyToAndOverwrite(oDoc)
    

API Reference

Please find the API Reference here.

JSON File Schema

You can save your PropertyGroups object in a json file, to share definitions across code-bases. This allows you to modify the PropertyGroup definitions without touching your deployed code.

  • Generic JSON schema:

    {
        "Groups": {
            PropertyGroup Name: {
                iProperty Name: iProperty Value,
                iProperty Name: iProperty Value,
                etc
            },
            PropertyGroup2 Name: {
                iProperty Name: iProperty Value,
                iProperty Name: iProperty Value,
                etc
            }
        }
    }
    
  • An actual JSON file example:

    {
        "Groups": {
            "Purchased": {
                "Title": "=<Description>",
                "Manufacturer": "ACME",
                "Source" : "Purchased",
                "Material Number": "",
                "Inventory Number" : "default",
                "Part Number" : "=<Inventory Number>"
            },
            "Fabricated": {
                "Title": "=<Description> <MaterialNumber>",
                "Manufacturer": "",
                "Source" : "FABRICATED",
                "Material Number": "000-005",
                "Inventory Number" : "default",
                "Part Number" : "=<Drawing Number>",
                "Drawing Number" : "default"
            }
        }
    }
    

Build

  • Build Target: .net Framework 4.7
  • Tests Build Target: .net 5.0

This project aims to be developed primarily via Test Driven Development. The only bits of code that will not be driven by TDD are the bits that interface with Inventor itself.

License

This code is under an MIT license.

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