iLogic retrieving old values from part

iLogic retrieving old values from part

S7RM7RPR
Advocate Advocate
491 Views
14 Replies
Message 1 of 15

iLogic retrieving old values from part

S7RM7RPR
Advocate
Advocate

I can't figure out what's going on. It was working literally 3 weeks ago and then when I open it up this week, it suddenly doesn't want to work correctly.

 

I have an .idw that has a bunch of field text that iLogic is supposed to replace with values from the part that is on the .idw. aka, PART_QTY1, PART_QTY2, etc etc.

 

Right now for whatever reason, iLogic is only retrieving the values that were in place the last time the part was saved. So when I re-run the part to update the quantities, the .idw won't retrieve the new values, just the old ones.

 

My most recent discovery however, is that this problem is specific to the .idw I've already set up. When I put the code into a brand new .idw it picks up the new values without a problem.

 

My current solution, without making a new drawing, is to save the part before I run the .idw. I would like to be able to not do this however as it adds a significant amount of run-time.

 

Any thoughts?

0 Likes
492 Views
14 Replies
Replies (14)
Message 2 of 15

MechMachineMan
Advisor
Advisor
Post your code.

--------------------------------------
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 3 of 15

S7RM7RPR
Advocate
Advocate
It's just a simple parameter retrieval. Absolutely nothing fancy. One line. The exact same code retrieves different values while in the old .idw or the new one.

Dim STD_QTY As String = Parameter("SUPPLIER PANELS.iam.STD_QTY")
0 Likes
Message 4 of 15

MechMachineMan
Advisor
Advisor
Try using this for the 2nd half: ThisApplication.ActiveDocment.componentdefinition.parameters.item ("Name").Value

--------------------------------------
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 5 of 15

S7RM7RPR
Advocate
Advocate

Error in rule: Rule6, in document: SUPPLIER DWG.idw Public member 'ActiveDocment' on type 'Application' not found.

0 Likes
Message 6 of 15

MechMachineMan
Advisor
Advisor
Soooooo fix my spelling mistake and write "document" instead.

--------------------------------------
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 15

S7RM7RPR
Advocate
Advocate
Apparently neither of us can spell then. Now it has a problem with componentdefinition
0 Likes
Message 8 of 15

S7RM7RPR
Advocate
Advocate
Just to make sure, I'm putting this in the .idw right?
0 Likes
Message 9 of 15

MechMachineMan
Advisor
Advisor
Ahhh sorry. ThisApplication.Documents.ItemByName(C:\Filepath\Filename.ipt).Component definition.... and so on

--------------------------------------
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 10 of 15

S7RM7RPR
Advocate
Advocate

'Dim tempnote As String = ThisApplication.Documents.ItemByName("(path)\SUPPLIER PANELS\SUPPLIER PANELS.iam").ComponentDefinition.Parameters.Item(Parameter("SUPPLIER PANELS.iam.NOTE1")).Value

 

System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack)
at LmiRuleScript.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

0 Likes
Message 11 of 15

S7RM7RPR
Advocate
Advocate
Never mind got it. Still the same problem though
0 Likes
Message 12 of 15

MechMachineMan
Advisor
Advisor
Get rid of parameter inside of Item and just write .Item("NOTE1").

--------------------------------------
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 13 of 15

S7RM7RPR
Advocate
Advocate
I'm still getting the original problem with that new code
0 Likes
Message 14 of 15

S7RM7RPR
Advocate
Advocate
Just a thought, but could the problem be with the actual part instead? It's not storing the information correctly or something? When I view the part and the parameters it's all there, but maybe it isn't actually storing it or something...
0 Likes
Message 15 of 15

MechMachineMan
Advisor
Advisor

The only way i could see that as causing issue would be if you were to actually be looking at 2 different files, thinking they were one. Ie; if you replaced a file but the browser node for it didn't change, leaving you to think it's the same part or something similiar.


--------------------------------------
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