Hi I'm new to the forum, and i hope someone can help me ! 🙂 I'm currently using Inventor 2012 and i need a macro (code): I want to know if it's possible to export all the information from the parameters list (everything, names, values, tolerances, comments...) to an excel spreadsheet or a txt file (it can be a table, or a CVS file, i just want that information!), from a part file (.ipt) or a drawing file (.dwg). Currently, i can only export the parameters' names and values , but i can't get to the tolerance values and comments . . . Is there anyway to do this ? Many thanks, Regards JVC |
Hello JVC,
I attach an IVB file that you can use to export parameter properties to excel, you can modify it to export any other properties you want.
Hope it helps.
Hello yuhanzhang
Thank you for your reply, but when i try to run the macro, an error message shows up:
" Compile Error: can't find project or libray." 😕
How do i solve this ?
Regards,
JVC
Can you tell which line the error occurs? And have you Excel 2010 installed on your machine, or a different version? If you have a different Excel version installed, then please change the reference to that Object Library:
1. Load the IVB into VBA Editor.
2. Click Tools->References.
3. In the References dialog find the "Microsoft Excel *.0 Object Library", the '*' indicates the version number that you have.
Please let me if this solves.
The error occurs in line 10 ("Dim oExcel As Excel.Application"), but line 1 turns yellow ("Sub ExpoertParamToText()")
I currently have M.Office Excel 2007, and on Tools > References , I have a "MISSING: Microsoft Excel 14.0 Object Library" checked... Is it supposed to be that way ?
Thank you for your help so far!
JVC
Sorry for late response. I added the reference to Excel 2010(Microsoft Excel 14.0 Object Library) in the IVB file, if you have the Excel 2007 then you have to modify the reference to your version.
Hello Zhang,
Thank you so much for your help, i was able to do it ! 🙂
I just needed one more thing: is it possible to export the tolerance information? For example:
- if i have a hole in a part, and i set the deviation tolerance, with maximum and minimum values, can i export these ?
- or if i set a H7 tolerance for a hole (or a shaft), can i export these too ?
Once again, thank you!
Regards,
JVC
Yes, sure you can. You can get the Upper, Lower, HoleTolerance and ShaftTolerance from Parameter.Tolerance object. You can firstly check what tolerance type the parameter is set, and then export the tolerance values you want.
In order to do that, do i have to change/edit the code?
Wich lines do i have to edit (or add) and in wich section of the code ?
Can you help me do that ?
Thank you so much, you really helped me and my project ! 😄
Regards,
JVC
Try attached IVB.
It worked ! 😄
Thank you so much for your help, once again, without you I wouldn't be able to finish my project !
Regards,
JVC
Hello and sorry for the late response, i had tons of work to do 😕
Yes, the IVB you provided me works really well, thank you!
But (once again), i just have one more doubt:
- when you define a hole tolerance as H7 (or other), Inventor automatically sets the upper and lower tolerance values according to the nominal diameter of the hole, right ? So, my question is: when Inventor sets these values, is there a way to access and export them both - H7 and the respective tolerance values (upper and lower) ?
I'm not sure if I explained myself correctly, but if you can help me or have any questions, feel free to ask them !
Thank you again,
Regards
JVC
Sure, the Upper/Lower values are already there and you can export them. See updated attachment.
Hello, and I'm sorrry for the late response !
It aal works perfectly fine , thank you !
Hello,
I hope you're doing well.
Regarding to the previous problem I had, there is a question I sttil have:
- when modelling a part file in Inventor, only the dimensions we set (dimensions we give a name and a value), are listed in the parameters table. This way, the macro you gave me only exports the information listed in that table.
- the information listed in the parameters table is based on sketches and features dimensions, as obvious.
So , my question is: is it possible to access the information (dimension values) contained in a feature (or a sketch) without setting a specific name or value to it?
For example, in the attached pictures, if a rectangular form is drawn and the dimensions are setted, these will be lisetd in the parameters table (see attached "pic1" and "pic1 - params").
But, in the other hand, if the same rectangular form is drawn, but this time without setting any dimension, the parameters table will be empty, obviously (see attached "pic2").
After this, i can surely presume that Inventor saves or keeps this information somehow, somewhere, without having to set dimensions or values.
So, my question is: is it possible to access sketches and/or features information without setting this values?
I hope i have explained my doubt correctly, if not, let me know!
My best regards,
JVC
Hello, Zhang:
I tried to do as you said, I got a inform " User Defined type not defined"
What can I do now?
Thanks!
Wei
This sounds like a similiar issue I mentioned above, you should have a proper Excel Object Library referenced for this VBA to work. The attached VBA has the Excel 2010(14.0) referenced, if you have a different Excel version installed you should change it to yours. You can get to the References dialog from Tools->References....
Hope this helps.
Can't find what you're looking for? Ask the community or share your knowledge.