Sample API Programs

Top | Previous |

 

For a better understanding of how the Woodwork for Inventor API works, some sample programs are provided together with the installation:

 

C:\W4INV 2022 Design\PROJECTS\Samples\API Samples\Shelf.ipt
C:\W4INV 2022 Design\PROJECTS\Samples\API Samples\Standing Cabinet\Cabinet.iam

 

Shelf.ipt contains VBA functions that demonstrate the operation of the Woodwork for Inventor API functions on a part model. The functions programmed are simple and for those who have experience with Autodesk Inventor API, it will be easy to understand what the functions do and how to program them to achieve the desired operation. The names of the functions make it clear what operation is being performed with it.

 

Cabinet.iam demonstrates a possible practical application of the Woodwork for Inventor API.

 

Cabinet_iam

 

In this case, it is about the possibility to create a configurable cabinet (using iLogic programming). To run the configuration, use the iLogic form “Cabinet Configuration”, which is available in the Cabinet.iam component. After launching it, you will be able to configure the following cabinet parameters:

 

Cabinet Configuration dialog

 

 

The "Set Cabinet Config” rule is responsible for changing the cabinet dimensions. The length, width and depth parameters set in the form, which control the overall geometry of the cabinet, are passed to the Skeleton component. If the width of the cabinet exceeds 400 mm, the cabinet shall have two doors instead of one. With one door, the side of the door leaf can be changed. This rule employs exclusively Autodesk Inventor iLogic capabilities.

 

The “Set W4INV Material Configuration” rule is responsible for the manipulation of Woodwork for Inventor materials and it is the Woodwork for Inventor API that works there. There are four possible material assignment configurations. These configurations are expressed as the Cabinet.iam component parameter ColoringConfiguration, which is defined as a multi-value parameter and can take the following values:

 

Bright Facade From LMDF
Dark Facade From LMDF
Facade Coated by Bright Veneer
Facade Coated by Dark Veneer

 

The value of this parameter in the “SetMaterialsByConfiguration” function overrides the values assigned to the variables that carry the material names. You can find out which materials are involved in each configuration by looking at the function “SetMaterialsByConfiguration” in the given rule. The first two configurations carry a laminated board for the parts, the edges of which are covered with edge bands of PVC material of different thickness.  The next two colour configurations carry MDF and are covered with veneer. The inner side shall be covered with a compensation sheet.

 

Some additional explanations on how the material assignment rule “Set W4INV Material Configuration” works.

 

First, a few preparatory steps have been carried out on the model. Woodwork for Inventor does not differentiate between facade and carcass parts. It can be created by assigning materials. However, it is possible to have a configuration where the material of the facade and the material of the carcass are the same, in which case there is no such difference. In the case of configuration, the software needs to know what is the facade and what is the carcass. To this end, it is sufficient to create a Custom iProperty “AppearanceType” for each cabinet part, i.e. assign the AppearanceType value “Facade” to the parts that are considered as facade and the corresponding value “Carcass” to the carcass. In this way, the program iterates through the whole assembly and looks for the Custom iProperty “AppearanceType” value for each part and thus knows which part it is dealing with. Accordingly, it searches the database for the required materials and assigns them to the part according to the parameters set in the configuration.

 

When coating a part, it is important to know which facade is the outer side of the part, which is the inner side and which facades are the edges. For this purpose, they need to be marked in advance. The Nifty Attributes software, developed by Brian Ekins and freely available on the https://ekinssolutions.com/nifty_attributes/ website, has been used for this marking. This program allows the desired attributes to be assigned to each facade of a part. For this purpose, an Attribute Set “W4INVFaceType” has been created, in which the attribute “Type” was created. Depending on the position of the facade in the part, this attribute has been populated with the values “Top”, “Bottom” and “Edge”. The iLogic program scans all the facades of the part, reads the “Type” attribute and decides which cover material to assign based on its value.

 

Thus, the “Set W4INV Material Configuration” rule reads the user-selected value of the ColoringConfiguration parameter and, based on this, assigns the corresponding values to the variables that represent the application of the required materials on the furniture parts. Next, it goes through all the parts of the Cabinet.iam Assembly and, based on the Custom iProperty AppearanceType, it finds out which part (facade or carcass) it is dealing with and assigns the corresponding fill material. For each part, it then scans all the facades that have Attribute Set “W4INVFaceType” and decides, based on the type value, which cover material should be assigned to the given facade.

 

The “Set Grain Direction” rule is used to control the texture direction of the facade. The direction is set via a parameter.

 

This example is just one of the possible ideas for creating a configurable piece of furniture. The user can realise his/her own completely different concept of configuring a piece of furniture, or it can even be a non-configurable task. The most important thing is to have a good idea of the purpose of the application to be developed and to be aware of the possibilities provided by both the Autodesk Inventor API and the Woodwork for Inventor API and to use them effectively in the development.