Get iProperty "Cost" Value

Get iProperty "Cost" Value

isocam
Collaborator Collaborator
1,132 Views
6 Replies
Message 1 of 7

Get iProperty "Cost" Value

isocam
Collaborator
Collaborator

Can anybody help?

 

I have a part that has a iProperties "Estimated Cost" value of £37.89

 

Does anybody know how I can get this value, using a VBA macro.

 

For test only, display his value in a message box.

 

Many thanks in advance!!!!

 

Darren

0 Likes
1,133 Views
6 Replies
Replies (6)
Message 2 of 7

dano0310
Advocate
Advocate

Hi Darren

 

Try this one.

 


Sub Costing() MsgBox ("The cost of this item is " & ThisApplication.ActiveDocument.PropertySets(3).ItemByPropId(36).Value) End Sub

 To get the property id's go to ipropertiesandparameters.

 

Page 13 has a list of the id in each property set.

 

Property set 1 is the Inventor Summary information

Property set 2 is the Inventor Document Summary information

Property set 3 is the Design tracking properties

 

Cheers

Dan

 

0 Likes
Message 3 of 7

MechMachineMan
Advisor
Advisor

Dan, I'm just curious, but is there a reason why you use the integer indexes vs the strings?

 

From what I've read, it seems that using the strings would make more sense as it is easier to read/debug when coming back to it, vs integers being a bit less intuitive, and needing a document to translate.

 

ie; if you use

 

ThisApplication.ActiveDocument.PropertySets.Item("Design Tracking Properties").Item("Cost").Value 

 

simply looking at the line, it's quite evident as to what it is.

 

Again, just wondering for the reason behind doing otherwise.

 

Thanks!


--------------------------------------
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
0 Likes
Message 4 of 7

dano0310
Advocate
Advocate
Hi Mmm
When i first started to teach myself object oriented coding I didnt realise you could. Now i stick with the integer call ups because i know i cant misspell it.

Also some of the examples use the integer callups.
Cheers
Dan
0 Likes
Message 5 of 7

dano0310
Advocate
Advocate
Oh and also less typing.
0 Likes
Message 6 of 7

MechMachineMan
Advisor
Advisor
Fair enough; it seems my only argument against using integers is that if someone else ever has to look at it/come back to it, they MUST go back to that reference sheet to find what you are trying to pull, rather than seeing it in plain text.

And less typing might seem like time savings now; but if it is not less typing in the name of simplifying the function of the code/presenting it more clearly, I fear it just results in more typing when it comes time to debug.

--------------------------------------
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
0 Likes
Message 7 of 7

dano0310
Advocate
Advocate
Good point. I currently have a graduate engineer who is teaching himself inventor vba and it would make his life a lot easier. He doesnt have write access to the company macros but he does make local changes and send them to me as proposed updates.
I might have to do a ctrl H and replace the integers with text.
Thanks for the suggestion
0 Likes