r/InventorAPI • • Mar 24 '19

Programming for Autodesk Inventor has been created

4 Upvotes

This is a place to discuss Add-ins, iLogic, VBA macros, and interface customization for Autodesk Inventor.


r/InventorAPI • • May 14 '19

Need help to create parts driven by an assembly

2 Upvotes

Hello Pros here,

I am quite new with Inventor ilogic but I would like to automatize a project I have.

I want to create an assembly that is given a number ABCDE.VWXYZ.

For this I have 3-6 different parts which again have 12-24 different sizes. For these parts I have created base parts adapted to size and type via ilogic.

The number includes size, type, making, number and so on of the single parts

So my goal is to open the assembly, enter the correct number and Inventor/ilogic then

- adapts the base parts to the (number driven) correct size and type

- saves the parts with the correct number (the number will be slightly different than the assembly number but driven by it)

Is this possible?

Alternatively I would create the parts in all different sizes and then replace the base parts with the parts I have created. All driven by the assembly number.


r/InventorAPI • • Dec 09 '19

Updated iLogic - Starwars Intro

3 Upvotes

r/InventorAPI • • Sep 23 '19

Enhanced BoM Export With iLogic

Thumbnail
clintbrown.co.uk
3 Upvotes

r/InventorAPI • • Feb 17 '20

Email your Bill of Materials directly from Inventor

Thumbnail
self.autodeskinventor
3 Upvotes

r/InventorAPI • • Mar 25 '19

iLogic Resources

3 Upvotes

r/InventorAPI • • Sep 14 '19

Let's Talk About iLogic Errors (& GDPR?)

Thumbnail
clintbrown.co.uk
3 Upvotes

r/InventorAPI • • Jun 24 '19

Heads or Tails with iLogic (UPDATED)

Thumbnail
clintbrown.co.uk
2 Upvotes

r/InventorAPI • • Apr 05 '19

Cosmetic welds in 2020 API

2 Upvotes

r/InventorAPI • • Feb 04 '20

iLogic: Clear Part Appearance Overrides – Updated

Thumbnail
self.autodeskinventor
2 Upvotes

r/InventorAPI • • Jan 09 '20

Inventor 2017 > 2020 API processing changes

2 Upvotes

Hoping someone with some knowledge of how external API calls are processed can help and can shed some light on the issue below.

We have quite a unique implementation of Inventor. We have windows servers that run up to 12 instances of Inventor each. Each instance has its own project file and separate inventor files. An application on each server listens for jobs to process, when a job comes along it opens a specified inventor assembly and executes an iLogic rule via a parameter trigger (the models contain very detailed rules written either in iLogic or contained in a .NET dll) Running the rule via parameter trigger ensures that the API processing is handled ‘in-process’ and has dramatic performance improvements compared to the RunRule API call which processes API calls externally.

We’ve just upgraded from 2017 to 2020 and are seeing some terrible processing speeds. I think I’ve narrowed it down the external API calls we execute from the job processing application, namely opening the file and secondly iterating the assembly to build an XML of the BOM. The BOM process is heavy on API calls - among other things we retrieve all iProperty values from each document - each document can have hundreds of iProperties.

As a comparison generating the BOM in 2017 may take up to 15 minutes at worst. In 2020 worst case is well over 60 minutes.

Nothing has changed in the hardware.

We have a Windows 7 physical machine that is the most severely affected. This was previously the most efficient and most reliable server. Changes on there are the 2020 upgrade and the required Microsoft KB that Autodesk specifies. Other machines are a mixture of physical and virtual windows 10 machines.

I can only assume that there have been changes in how external API requests are handled/prioritised within inventor.

We are working with the developer of the job processing application to try and make the BOM processing logic process as in-process and crossing our fingers that gets us 80% back to normal.

Any help and advice would be greatly appreciated.

Thanks Tom


r/InventorAPI • • Mar 27 '19

[iLogic] Save DXF for all sheet metal parts in an assembly.

3 Upvotes

This code is meant to be run as an external iLogic rule from an assembly file. I do not claim this as original code. I just adapted a few rules I found elsewhere to suit my purpose. It goes through each sheet metal part, creates the flat pattern, and saves it as DXF to the desired path. Code below.

Sub Main()

Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument

'If document is not assembly, alert user and exit rule
If oDoc.DocumentType <> kAssemblyDocumentObject Then
    MessageBox.Show("This rule must be run from an Assembly.", "iLogic")
    Exit Sub
End If

'get user input
RUsure = MessageBox.Show ( _
"This will create a DXF file for all sheet metal components." _
& vbLf & " " _
& vbLf & "Are you sure you want to create a DXF for all of the sheet metal components in this assembly?" _
& vbLf & "This could take a while.", "iLogic - SaveAllDXF ",MessageBoxButtons.YesNo)
If RUsure = vbNo Then
    Return
 Else
End If

'- - - - - - - - - - - - -Establish DXF Save Path - - - - - - - - - - - -
oPath = ("C:\PATH\TO\FOLDER\") 'Must include final backslash
'- - - - - - - - - - - - -Components - - - - - - - - - - - -
Dim oRefDocs As DocumentsEnumerator
Dim oRefDoc As Document
oRefDocs = oDoc.AllReferencedDocuments

'Iterate through referenced docs
For Each oRefDoc In oRefDocs
    Dim oCurFile As Document 'current file
    Try
        oCurFile = ThisApplication.Documents.Open(oRefDoc.FullFileName, False) 
            'False == open invisible, True == open visible. invisible is much faster.
     Catch
        GoTo NextIteration
    End Try
    
    If oCurFile.DocumentSubType.DocumentSubTypeID <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
        'document is not sheet metal. 
        oCurFile.Close(True) 'True == skip save
    Else
        oCurFileName = oCurFile.FullFileName
    
        'get the postion of the last backslash in the path
        FNamePos = InStrRev(oCurFileName, "\", -1)
        'get the file name with the file extension
        FName = Right(oCurFileName, Len(oCurFileName) - FNamePos)
        'get the file name (without extension)
        FName = Left(FName, Len(FName) - 4)
        'set dxf filename
        DxfName = oPath & FName & ".dxf"

        Dim oSMCD As SheetMetalComponentDefinition = oCurFile.ComponentDefinition
        If Not oSMCD.HasFlatPattern Then 'If it doesn't have a flat pattern, create one (unfold the model)
            oSMCD.Unfold()
            oSMCD.FlatPattern.ExitEdit()
        End If

        'set dxf options
        Dim sOut As String = "FLAT PATTERN DXF?AcadVersion=2004" _
            + "&OuterProfileLayer=IV_INTERIOR_PROFILES" _
            + "&InvisibleLayers=IV_TANGENT;IV_FEATURE_PROFILES_DOWN;IV_BEND;IV_BEND_DOWN;IV_TOOL_CENTER;IV_TOOL_CENTER_DOWN;IV_ARC_CENTERS;IV_FEATURE_PROFILES;IV_FEATURE_PROFILES_DOWN;IV_ALTREP_FRONT;IV_ALTREP_BACK;IV_ROLL_TANGENT;IV_ROLL" _
            + "&SimplifySplines=True" _
            + "&BendLayerColor=255;255;0"
        Try
            oSMCD.DataIO.WriteDataToFile(sOut, DxfName) 'save the dxf
         Catch
        End Try

        oCurFile.Close(True)
    End If	
    NextIteration:
Next

'- - - - - - - Display Results - - - - - - - - - - - - -
MessageBox.Show("New Files Created in: " & vbLf & oPath & vbLf & vbLf & "Please verify that all DXFs are correct.", "iLogic")

'open the folder where the new files are saved
Shell("explorer.exe " & oPath,vbNormalFocus)

End Sub


r/InventorAPI • • Jun 08 '19

Unique names for multibody solids

3 Upvotes

Maybe this is an easy one, but I would like to automatically name the solids in a multibody part so that when I use the “make components” command the file names for all the solids are unique and related to the user inputs. Can you create a specific name for solids generated from a specific extrude command and then for instance, if that solid is patterned, duplicate the name with a suffix like “bracket_3” or similar? Consider the resulting assembly might generate 200 solids but is actually maybe 10 unique parts that are patterned.


r/InventorAPI • • Mar 25 '19

Creating Add-ins using Visual Studio

2 Upvotes

Disclaimer: I'm an engineer, not a programmer. I still have a lot to learn, and there is plenty of room for improvement in my current setup.

I'm currently using Inventor 2015 and Visual Studio Express 2012. More recent versions of VSE did not work with Inv2015. And I chose Express because I'm using it for work and did not want to run into any license issue with VSCommunity. I installed the Nifty Add-In Template created by Brian Ekins. It's made for Inventor 2018 and later, but I haven't had an issue yet with 2015. The template contains sample code for creating a button in the tools ribbon while a part document is active in Inventor. Within this template, I added this code to CommandFunctions.vb. This allows me to point to an external iLogic rule, instead of having to convert it to VB.NET.

The end result is that I'm able to keep writing external iLogic rules, and when they are polished and ready to share with the rest of the engineering department, I can just give everyone a button. The button will only appear on the document type where it is meant to be run. No chance of running "Print Drawing" on anything but a drawing document. It ends up looking much cleaner and official than asking everyone to always keep the iLogic browser open and just remember which rules work for each document type.

When I have more time, I may make a more detailed step-by-step guide for this setup. But I wanted to give a quick-and-dirty explanation now in case anyone is trying to make the jump from external rules to add-ins.

Everyone feel free to share your setup, and criticize mine!


r/InventorAPI • • Jul 15 '19

Attempting to handle an OnActivateCommand event but the screen doesn't update?

2 Upvotes

I'm trying to write a small adding that will automatically slice graphics when a 2d sketch is created or edited.

 

Attached is a snip of the program. What it does is looks for any command that is triggered and checks to see if it is "PartNewSketchCmd". Once the correct command is run, I'm able to Step through the program and see that it will go through the ControlDefinition line, then execute the command (no errors) then exit the sub.

 

The problem is that the screen does not update. Suggestions on what to change?

Image link


r/InventorAPI • • Dec 05 '19

iLogic – Suppress/Unsuppress and Delete Rules

Thumbnail
self.autodeskinventor
2 Upvotes

r/InventorAPI • • Aug 31 '19

Mirror Part and Drawing with iLogic

Thumbnail
clintbrown.co.uk
3 Upvotes

r/InventorAPI • • Jan 31 '20

Ever wonder “What is iLogic?” Here’s the answer

Thumbnail
clintbrown.co.uk
3 Upvotes

r/InventorAPI • • May 08 '19

iLogic – Set Every Part to A Different Colour

Thumbnail
self.autodeskinventor
2 Upvotes

r/InventorAPI • • Jul 07 '19

Control Drawing View Reps & Style with iLogic

Thumbnail
clintbrown.co.uk
3 Upvotes

r/InventorAPI • • Aug 05 '19

iLogic Error – “The Cloud File Provider is Not Running”

2 Upvotes

I ran into this error on the weekend, and the fix was surprisingly simple: https://clintbrown.co.uk/2019/08/04/ilogic-error-the-cloud-file-provider-is-not-running/


r/InventorAPI • • Jan 09 '20

Display Assembly Mass on BoM with iLogic?

Post image
2 Upvotes

r/InventorAPI • • Nov 11 '19

iLogic – Open File Location

Thumbnail
clintbrown.co.uk
3 Upvotes

r/InventorAPI • • Feb 22 '20

Free Unit Converter for Inventor

Thumbnail self.autodeskinventor
2 Upvotes

r/InventorAPI • • Mar 21 '20

One Rule to Search Them All - Guest Post

Thumbnail
self.autodeskinventor
2 Upvotes