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: 

Why error?

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
116 Views, 5 Replies

Why error?

what am I missing or doing wrong here.. why is there always a error after Set oParamTableFiles = oParams.ParameterTables in this code?? dim oDoc as Inventor.Document Set oDoc = ThisApplication.ActiveDocument Dim oParams As Parameters Set oParams = oDoc.ComponentDefinition.Parameters If oParams.ParameterTables.Count > 0 Then Dim oParamTableFiles As ParameterTables On Error Resume Next Set oParamTableFiles = oParams.ParameterTables If Error Then Debug.Print Err.Description Debug.Print Err.Number ' ' Err.Clear '' Exit Sub End If -- Kent Keller Autodesk Discussion Forum Facilitator
5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: Anonymous

Very strange... API bug, perhaps? The code actually works in that the oParamTableFiles object gets set correctly, but still generates an error.
Message 3 of 6
stibbetts
in reply to: Anonymous

this will get you to wher you want to go. remember to replace 'c:\part_path' with the path and file name that you want this to change.

Dim oPartDoc As Inventor.PartDocument
Dim InvApp As Inventor.Application
Dim invdoc As Document
Set InvApp = GetObject(, "Inventor.Application")
Set invdoc = InvApp.Documents.Open(("c:\part_path", True)
Set oPartDoc = ThisApplication.ActiveDocument
Dim oParams As Parameters
Set oParams = oPartDoc.ComponentDefinition.Parameters
Dim oParamTableFiles As ParameterTables
Set oParamTableFiles = oParams.ParameterTables

hope this helps,
sam
Message 4 of 6
Anonymous
in reply to: Anonymous

Thanks but unless I am missing it (very possible) I don't think that is any different than mine? The issue is that a error is thown when it gets to Set oParamTableFiles = oParams.ParameterTables ... it doesn't stop the code or anything, but it keeps me from using "On Error Resume next" to escape if there is no table. It isn't a huge deal, I can work around it, but it seems to me to be a bug??? -- Kent Keller Autodesk Discussion Forum Facilitator "stibbetts" wrote in message > Set oParamTableFiles = oParams.ParameterTables > > hope this helps, > sam
Message 5 of 6
Anonymous
in reply to: Anonymous

Kent: The problem is that you are testing the "Error" statement instead of the "Err" object. Change the line If Error Then to If Err Then The If statement was actually throwing the error "Invalid procedure call or argument". Comment out the On Error Resume Next to see it. rw -- Robert A. Williams http://www.leacar.com "Kent Keller" wrote in message news:40b6307c$1_1@newsprd01... > what am I missing or doing wrong here.. why is there always a error after > Set oParamTableFiles = oParams.ParameterTables in this code?? > > > dim oDoc as Inventor.Document > Set oDoc = ThisApplication.ActiveDocument > > Dim oParams As Parameters > Set oParams = oDoc.ComponentDefinition.Parameters > > If oParams.ParameterTables.Count > 0 Then > Dim oParamTableFiles As ParameterTables > On Error Resume Next > Set oParamTableFiles = oParams.ParameterTables > If Error Then > Debug.Print Err.Description > Debug.Print Err.Number > ' > ' Err.Clear > '' Exit Sub > End If > > > -- > Kent Keller > Autodesk Discussion Forum Facilitator > >
Message 6 of 6
Anonymous
in reply to: Anonymous

Sometimes you feel like a nut .... ;~) -- Kent Keller Autodesk Discussion Forum Facilitator "RobertWilliams" wrote in message news:40b645d8$1_2@newsprd01... > Kent: The problem is that you are testing the "Error" statement instead of > the "Err" object. Change the line > > If Error Then > > to > > If Err Then > > The If statement was actually throwing the error "Invalid procedure call or > argument". Comment out the On Error Resume Next to see it. > > rw > > -- > Robert A. Williams > http://www.leacar.com

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

Post to forums  

Autodesk Design & Make Report