r/InventorAPI • u/HagermanCompany • Dec 11 '23
r/InventorAPI • u/dable82 • Mar 28 '19
Using Python with Inventor API
Hey guys, if you are like me and hate writing Code in VBA you can actually write Python scripts for Inventor using the win32com.client module. To use the module, you have to `pip install pywin32`. Here is a sample of a pretty useless script, but it should be good enough to get you going.
If you have any Questions About what's going on here, feel free to ask.
edit: https://pastebin.com/1ZvSpku5
Code formatting doesn't seem to work.
r/InventorAPI • u/CoxCad • Mar 25 '19
So what are you working on at the moment?
I'm trying to wrap up an underdefined (yay billing by the hour) project
the configurator was easy once the client decided what they wanted
where I'm charging money is for the final function
Copy assy, subcomponents and drawings to new folder and spit out dxf files to project folder
I've almost had it right a few times, until i remembered no one paths the files and drawings the same
r/InventorAPI • u/Denis192 • Apr 06 '25
Inventor API and Python
Hello everyone, I'm very new to this sub and have some questions
So I am currently working on my Thesis and I want to create a script that automatically creates Wires in Inventor using Python (maybe it's easier in iLogic if you know please let me know).
Right now the code creates a line and a cricle but I fail to create the Sweep feature and I dont know what I'm doing wrong I was already looking into the Inventor API, searched Reddit and Youtube but cant find any answers.
Maybe some of you know what is wrong and can help me :) Any adivice is appreciated
import win32com.client as wc
inv = wc.GetActiveObject('Inventor.Application')
# Create Part Document
#12290 (Part Document) 8962(Metric System) aus der Inventor API Object Module
inv_part_document = inv.Documents.Add(12290, inv.FileManager.GetTemplateFile(12290, 8962))
#inv_part_document = inv.ActiveDocument
#Set a reference to the part component definition
part_component_definition = inv_part_document.ComponentDefinition
#print(dir(part_component_definition))
#print(part_component_definition.Workplanes.Item(3).Name)
tg = inv.TransientGeometry
#create sketch reference
sketch_path = part_component_definition.Sketches.Add(part_component_definition.Workplanes.Item(3))
# Create a path for the sweep (a line and an angled connection)
Line1 = sketch_path.SketchLines.AddByTwoPoints(tg.CreatePoint2d(0, 0), tg.CreatePoint2d(10, 3))
Line2 = sketch_path.SketchLines.AddByTwoPoints(tg.CreatePoint2d(10, 3), tg.CreatePoint2d(15, 3))
Line3 = sketch_path.SketchLines.AddByTwoPoints(tg.CreatePoint2d(15, 3), tg.CreatePoint2d(15, 0))
# Create a second sketch for the circle (profile for sweep)
sketch_profile = part_component_definition.Sketches.Add(part_component_definition.Workplanes.Item(1))
Circle1 = sketch_profile.SketchCircles.AddByCenterRadius(tg.CreatePoint2d(0, 0), 0.1)
Profile = Circle1
# Sweep-Definition
sweep_def = part_component_definition.Features.SweepFeatures.CreateSweepDefinition(104451, sketch_profile, path, 20485)
# Sweep-Feature
sweep_feature = part_component_definition.Features.SweepFeatures.Add(sweep_def)
import win32com.client as wc
inv = wc.GetActiveObject('Inventor.Application')
# Create Part Document
#12290 (Part Document) 8962(Metric System) aus der Inventor API Object Module
inv_part_document = inv.Documents.Add(12290, inv.FileManager.GetTemplateFile(12290, 8962))
#inv_part_document = inv.ActiveDocument
#Set a reference to the part component definition
part_component_definition = inv_part_document.ComponentDefinition
#print(dir(part_component_definition)) (zeigt alle möglichkeiten an)
#print(part_component_definition.Workplanes.Item(3).Name) heraussfinden welche Ebene
tg = inv.TransientGeometry
#create sketch reference
sketch_path = part_component_definition.Sketches.Add(part_component_definition.Workplanes.Item(3))
# Create a path for the sweep (a line and an angled connection)
Line1 = sketch_path.SketchLines.AddByTwoPoints(tg.CreatePoint2d(0, 0), tg.CreatePoint2d(10, 3))
Line2 = sketch_path.SketchLines.AddByTwoPoints(tg.CreatePoint2d(10, 3), tg.CreatePoint2d(15, 3))
Line3 = sketch_path.SketchLines.AddByTwoPoints(tg.CreatePoint2d(15, 3), tg.CreatePoint2d(15, 0))
# Create a sketch for the circle (profile for sweep)
sketch_profile = part_component_definition.Sketches.Add(part_component_definition.Workplanes.Item(1))
Circle1 = sketch_profile.SketchCircles.AddByCenterRadius(tg.CreatePoint2d(0, 0), 0.1)
Profile = Circle1
# Sweep-Definition
sweep_def = part_component_definition.Features.SweepFeatures.CreateSweepDefinition(104451, sketch_profile, path, 20485)
# Sweep-Feature
sweep_feature = part_component_definition.Features.SweepFeatures.Add(sweep_def)r/InventorAPI • u/jordanrobot • Jan 25 '21
InventorCode Announcement
r/InventorAPI • u/oomclint • Jan 14 '21
25 iLogic Routines to Speed Up Drawing Creation
r/InventorAPI • u/oomclint • Oct 28 '20
iLogic Quick Tip: Delete Sick Dimensions
r/InventorAPI • u/oomclint • Oct 24 '20
iLogic: Supress Constraints & Ground All Components
r/InventorAPI • u/oomclint • Jul 11 '20
iLogic – Centre & Arrange Dimensions
r/InventorAPI • u/oomclint • Jul 04 '20
Setting Dimension Precision with iLogic
r/InventorAPI • u/im_on_reddit_dot_com • Feb 25 '20
I made a CSharp template for inventor add-ins
r/InventorAPI • u/ItsOk_ImYourDad • Oct 12 '19
I want to access the inventor part history tree through the API using python to add features into folders in the tree. Thoughts ?
Specifically I want to be able to organize features into folders using the history tree in the part environment
Currently this is only possible in the assembly environment
My goal is to learn to access the inventor API using python to add this functionality
Please advise
r/InventorAPI • u/oomclint • Sep 30 '19
Assembly Surface Areas & an iLogic Hack
r/InventorAPI • u/im_on_reddit_dot_com • Mar 24 '19
Programming for Autodesk Inventor has been created
This is a place to discuss Add-ins, iLogic, VBA macros, and interface customization for Autodesk Inventor.
r/InventorAPI • u/Alexander556 • Aug 20 '24
Bevel Gear generator?
Is there an add in or anything similar to help with designing a Bevel gear onto a very specific surface and a corresponding gear onto a shaft?
I tried to use the Bevel gear generator in Inventor, but it looks like it doesnt work like the Spur Gear and the worm gear generator.
Any Idea what i could do about this problem?
r/InventorAPI • u/FroyoAbject • Feb 12 '24
Most of the AddIns won't work after Inventor 2025
With version 2025, add-ins based on the .NET Framework will no longer work; they must be migrated to the new .NET, which works differently in many ways than the .NET Framework. Even iLogic scripts may need to be adapted.
I think this is very critical, some companies have been using add-ins for decades, and for many of them the source code will no longer be available... That will have an impact!
Don't get me wrong, I think it's good that Autodesk is moving away from the old .NET Framework, but it will hurt.
What do you think about this? Will it affect your work/company?
r/InventorAPI • u/MrCannaHub • Feb 03 '21
Seeking experienced designer/engineer to complete a design. Your help is appreciated! Send a message to connect! ☺️
I am currently working on a project, and am in need of some help/direction on completing the design. I am stuck with coming up with the best concept/functionality for the project.
r/InventorAPI • u/oomclint • Dec 19 '20
Export Flat Patterns iPart: Get Name, Export, Repeat
r/InventorAPI • u/oomclint • Nov 24 '20
Quick Tip: Run “Before Save” Rule Only Once in Assemblies
r/InventorAPI • u/oomclint • Oct 17 '20
Running Inventor in the Cloud - with Forge
r/InventorAPI • u/oomclint • Jun 27 '20
iLogic: Using Try - Catch to Open Drawings
r/InventorAPI • u/oomclint • Jun 07 '20