Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Batch edit iProperty based on excel table?

15 REPLIES 15
SOLVED
Reply
Message 1 of 16
michael.sheldon153
3299 Views, 15 Replies

Batch edit iProperty based on excel table?

Hello,

I have excel table with files name and description. Is there any way to batch fill iProperty description field based on my excel table? I mean like "if file name is AA, description will be BB" and so on...

 

Thank you.

15 REPLIES 15
Message 2 of 16

Many ways. Depends on how you want to accomplish it/what you want user inputs to be.

 

ie;

 

Use excel and have excel load the model and edit the files there.

 

Or use inventor and get it to pop open a table for the user to edit it there, and save the changes when closing,

 

etc.

 

And do you really just need iProperty population based off of if statements, or you want a table to bulk edit iProperties as in the Bills Of Materials within inventor, but with excel formula functionality?


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 3 of 16

Hi michael.sheldon153,

 

You could use iLogic for this. I do pretty much the same thing at this link, the difference is rather than an iproperty I was writing to a prompted title block (yuck! Smiley Embarassed )

 

If iLogic is something you'd consider, and the link doesn't help, let me know and I'll work up a quick example (tomorrow).  Edit: just saw that @ MechMachineMan replied, he'll likely come up with something better that I would have anyway. Smiley Wink What version of Inventor are you using?

 

http://inventortrenches.blogspot.com/2014/06/ilogic-titleblock-project-data-from.html

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Message 4 of 16

Thanks for answers.

I have over thousand step files without description. I did rename them easily and quickly in cmd line witch script created by Excel formula "ren aaa bbb" "ren ccc ddd"..... Copy, paste, enter, 1000 files done.

Now I need similar workflow for editing description. Task Scheduler only converts steps to ipts for me unfortunately...

 

I have 2017 version.

 

Thank you again.

 

Message 5 of 16

Ok. So I created simple iLogic rule which read Excel and write appropriate iProperty Description.

Now,how could I apply this iLogic rule to bunch of files without manually opening every one of them?

 

Thank you.

Message 6 of 16

Hi michael.sheldon153,

 

Here is a "batcher" file I created in the past that you can download: iLogic Part Batch Tool 2015.v.1.4.ipt 180 KB

 

Create a rule in this file and put your code in it. Make sure that your code specifies ThisApplication.ActiveEditDocument rather than ThisApplication.ActiveDocument in order set the focus to the parts that it opens (rather than the "batcher" file).

 

If you have 200 files to run, try it on 10 to start with, and once you know it's working, you can try larger batches.

 

Post your code if you have issues getting it to run, and I'll have a look.

 

related link:

https://forums.autodesk.com/t5/inventor-forum/any-way-to-automatically-update-all-related-drawings/m...

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Message 7 of 16

Hello Curtis,

it looks promising, thank you.

 

Here is my code:

name = ThisDoc.FileName(False) 
If GoExcel.FindRow("tst.xlsx", "Sheet1", "Name", "=", name)
	iProperties.Value("Project", "Description") = GoExcel.CurrentRowValue("Desc")
End If

Where am I suppose to add "ThisApplication.ActiveEditDocument"?

 

Thank you again.

Message 8 of 16

Hi michael.sheldon153,

 

Might be a bit more "long winded" than it needs to be, but try this:

 

'set the target document 
oDoc = ThisApplication.ActiveEditDocument

'example: "C:\TEMP\9876543210.ipt"
sPathAndName = oDoc.FullFileName

'split into an array
oSplit = Split(sPathAndName,"\") 
'example: "C:\TEMP\9876543210.ipt"
'	oSplit(0) = C:
'	oSplit(1) = TEMP
'	oSplit(2) = 9876543210.ipt"  <-- this is the Ubound for this example

'get the upper bound of the array
sNameWithExtension = oSplit(UBound(oSplit)) 

'get length of string
'example: 9876543210.ipt" , would return 14
iNameLength = Len(sNameWithExtension)

'remove last four chars, which is the extension ( example: .ipt )
sName = Left(sNameWithExtension, iNameLength - 4) 

'compare excel data
If GoExcel.FindRow("C:\TEMP\Test.xlsx", "Sheet1", "Name", "=", sName)

	' Get a reference to the PropertySets
	' we're really only using Design Tracking Properties in this case though
	Dim oPropSet1 As PropertySet
	oPropSet1 = oDoc.PropertySets.Item("Inventor Summary Information")
	Dim oPropSet2 As PropertySet
	oPropSet2 = oDoc.PropertySets.Item("Design Tracking Properties")
	Dim oPropSet3 As PropertySet
	oPropSet3 = oDoc.PropertySets.Item("Inventor User Defined Properties")

	'set value to excel data
	oPropSet2.Item("Description").Value = GoExcel.CurrentRowValue("Desc")
End If

 

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Message 9 of 16

It looks complex indeed but it works like a charm! 🙂

 

Thank you very much!

Message 10 of 16

Hello Curtis,

 

could you help me once more please?

I would like to edit Physical --> Mass iProperty as well. How can I do that?

 

I guess something like this, but I don't know PropertySets name:

 

 

Dim oPropSet4 As PropertySet
	oPropSet4 = oDoc.PropertySets.Item("What Goes Here???")

oPropSet4.Item("Mass").Value = GoExcel.CurrentRowValue("Weight")

 

btw,is there similar tool for assemblies?

 

 

Thank you.

Message 11 of 16

Hi michael.sheldon153,

 

So the mass props are a bit different. Just add these lines and you should be good to go.

 

'Set a reference to the mass properties object.
Dim oMassProps As MassProperties
oMassProps = oDoc.ComponentDefinition.MassProperties
oMassProps.Mass = GoExcel.CurrentRowValue("Weight")

 

As for an Assembly batch, I don't have one handy, but could make the part one do assemblies also (currently the selection dialog is just filtering for part files only) .  

 

Curious what you're needing to batch process for assemblies? Is it just iProperties as well?

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Message 12 of 16

Great! Thank you.

 

Its just for iProperties as well. I have over 200 assemblies (imported from step files) and I need to add description to them so I can have nice parts list in drawings.

Message 13 of 16

Hi michael.sheldon153,

 

Attached is an updated version of the batch tool that will run parts and assemblies. I only tested it briefly after the changes, so beware and do a couple of small batches first.

 

Note too that I updated the iProps from Excel run in this file, so it should be ready to go. Post back if you have issues.

 

And be sure to back up your files before you run this (just in case! )

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Message 14 of 16
Anonymous
in reply to: Curtis_Waguespack

Hi,

 

I also was trying to do something very similar, I wanted to edit the iproperties via excel. I was able to get the description section to work, however I was also trying to add information to a custom iproperty/parameter. I have code that will create a custom parameter & export it in each part and set it to a default value but now I'm trying to use excel to give that custom iproperty a new value from the excel sheet the same way as Description is filled in. Thanks for any help, I'm really new to programming in ilogic.

Message 15 of 16
IB55
in reply to: Curtis_Waguespack

Curtis

 

I am trying to use your tool to create Custom Properties in iProperties of assembly file.

Purpose of this exercise is to add COBi data for a BIM.

What changes should I make to your iLogic rule?

Where should I save my excel file?

What format my excel file should have?

 

I appreciate your help and I am sure many other inventor users will be very grateful to you too.

Message 16 of 16
cholte
in reply to: Curtis_Waguespack

Curtis,

 

How can you use the same script and replace Description with REV? I have to batch a bunch of files to remove the "0" in the REV field with a blank.

 

Thanks,

 

Corey

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report