Inventor Customization

Reply
Distinguished Contributor
thomaskennedy
Posts: 112
Registered: ‎09-27-2010
Message 1 of 7 (227 Views)

Strange Constraint.IsActive Error

227 Views, 6 Replies
01-15-2013 09:20 AM

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

ADN Support Specialist
adam.nagy
Posts: 521
Registered: ‎03-26-2007
Message 2 of 7 (207 Views)

Re: Strange Constraint.IsActive Error

01-30-2013 12:39 PM 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
Developer Technical Services
Autodesk Developer Network
Distinguished Contributor
thomaskennedy
Posts: 112
Registered: ‎09-27-2010
Message 3 of 7 (194 Views)

Re: Strange Constraint.IsActive Error

02-04-2013 02:35 AM 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

ADN Support Specialist
adam.nagy
Posts: 521
Registered: ‎03-26-2007
Message 4 of 7 (175 Views)

Re: Strange Constraint.IsActive Error

02-11-2013 07:52 AM 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
Developer Technical Services
Autodesk Developer Network
ADN Support Specialist
adam.nagy
Posts: 521
Registered: ‎03-26-2007
Message 5 of 7 (171 Views)

Re: Strange Constraint.IsActive Error

02-11-2013 08:05 AM 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
Developer Technical Services
Autodesk Developer Network
Distinguished Contributor
thomaskennedy
Posts: 112
Registered: ‎09-27-2010
Message 6 of 7 (153 Views)

Re: Strange Constraint.IsActive Error

05-03-2013 09:18 AM 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

ADN Support Specialist
adam.nagy
Posts: 521
Registered: ‎03-26-2007
Message 7 of 7 (126 Views)

Re: Strange Constraint.IsActive Error

05-14-2013 05:50 AM 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
Developer Technical Services
Autodesk Developer Network

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube