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: 

Strange Constraint.IsActive Error

6 REPLIES 6
Reply
Message 1 of 7
thomaskennedy
707 Views, 6 Replies

Strange Constraint.IsActive Error

Another one to add to my list of 2013 oddities.

 

I have a large model where I turn on/off constraints with iLogic using Constraint.IsAvtive = True/False

I sometimes get this error :

 

Error in rule: constraint error, in document: ESTTRS.iam

There was an error while trying to run the rule function:
Constraint.IsActive("Angle:5") = False

 

System.ArgumentException: There was an error while trying to run the rule function:
Constraint.IsActive("Angle:5") = False
---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: Exception has been thrown by the target of an invocation.
--- End of inner exception stack trace ---
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at iLogic.AssemConstraintForRule.set_IsActive(String constraintName, Boolean value)
--- End of inner exception stack trace ---
at iLogic.AssemConstraintForRule.set_IsActive(String constraintName, Boolean value)
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

I've seen this error appear a couple of times on different models too.

 

I can't put my finger on what's causing it, nor can I give a way to replicate it (which is frustrating)

I NEVER saw this error in 2013 and nothing has changed in the model since moving versions.

 

Can anybody shed any light on what could be casuing this error?

 

Thanks

Tom

6 REPLIES 6
Message 2 of 7
adam.nagy
in reply to: thomaskennedy

Hi there,

 

When you say you cannot replicate it, you mean that you cannot do it with a different model, or that even in the same model the error is just not systematic?

 

There may be some issue with the constraint itself. It would be useful to find out if you can reproduce the same problem through the user interface on the same constraint where iLogic (or Inventor API) is failing.

 

Cheers,



Adam Nagy
Autodesk Platform Services
Message 3 of 7
thomaskennedy
in reply to: adam.nagy

Hi,

 

Thanks for the reply.

 

From the testing I have done, it seems that the issue occurs when the model constraints have errors against them (missing geometry for example), having said that, not all constraints with errors will cause this issue (from what I have seen).

 

If I unsuppress the constraint manually, I get this error :

 

constraint error.jpg

 

I've managed to save a model in a state that I can reproduce the error, I could upload to dropbox if you think it would be useful.

 

In the meantime to stop the errors appearing I've played around with the order things are suppressed and wrapped the suspect Constraint.IsActve() calls in a Try / Catch.

 

Something internal to Inventor has changed between 2011 and 2013 to cause this error.

FYI we've spent around 2 years on 2011, and processed this particular model over 10,000 times in around 200 configs without issue.

 

Cheers

Tom

Message 4 of 7
adam.nagy
in reply to: thomaskennedy

Hi Tom,

 

Internal changes are possible - but behaviour change does not mean that there is an issue. Maybe the model does have some issue that previous versions ignored.

 

Can you reproduce the same error message when doing changes in the user interface of Inventor 2011?

 

Might be worth uploading the model so that people can have a look at it - make sure it contains no confidential information.

 

Do you also have issues if you are unsuppressing the component in VBA? - i.e. is it an iLogic or API behaviour.  

 

Cheers,



Adam Nagy
Autodesk Platform Services
Message 5 of 7
adam.nagy
in reply to: thomaskennedy

Do you still have the unmigrated 2011 files too?

If so, could you send an Inventor 2011 file that works there but fails in Inventor 2013?



Adam Nagy
Autodesk Platform Services
Message 6 of 7
thomaskennedy
in reply to: adam.nagy

Hi Adam,

 

Thanks for your replies and sorry for the (very) late reply!

We're still seeing this issue, so I uploaded an example.

 

Here’s a link to a model that demonstrates this error – note that this model was saved mid configuration, as the error appeared, so that I could reproduce it (so the model will look a bit odd).

 

https://www.dropbox.com/s/sn1tmqzkat8su9r/ESTTRS.zip

 

And here’s a video that shows the steps :

 

https://www.dropbox.com/s/7ano9wk66hpbtyx/ConstraintError.avi

 

  1. Open the model ESTTRS.iam
  2. DON’T update the model as it opens
  3. Run the ‘Constraint Error’ rule to see the error

 

I can create an error using the UI, but obviously not the same excpetion that iLogic throws (it's the error I posted earlier)

I agree that the problem could lie within the model that previous versions of Inventor were happy to ignore.

I haven't tried doing the same command through the API rather than iLogic, but I will give it a go.

 

Cheers,

Tom

Message 7 of 7
adam.nagy
in reply to: thomaskennedy

Hi Tom,

 

Thanks for the video and documents.

 

Why do you not want to update the assembly before running the code? If you make any changes Inventor will update it anyway? So why not do it up front?

 

Also you could check if the change is necessary and only then execute the code. e.g.:

If Constraint.IsActive("Angle:5") Then
	Constraint.IsActive("Angle:5") = False
End If

Cheers,



Adam Nagy
Autodesk Platform Services

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

Post to forums