Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
WCrihfield
in reply to: btomosonEYBLL

Now that I'm back in my office, I see someone has already expanded on my suggestion of using the:

iLogicVb.Automation.GetNamedEntities

route to get the named entities you were after.

However, I would suggest a slightly different line to get a single item from the collection.

When you use the "FindEntity() function, it may cause an Exception (error), if it doesn't find what you're looking for, so therefore it usually would need to be enclosed within a Try...Catch...End Try statement, in order to avoid the possible Exception from abruptly stopping your rule somewhere in the middle.

Instead, I would suggest you use the "TryGetEntity()" function.

 

Dim oNE As Object = iLogicVb.Automation.GetNamedEntities(ThisDoc.Document).TryGetEntity("Entity's Name")

 

It will eliminate the need for the Try...Catch...End Try statement, because if it doesn't find the entity, it will simply return 'Nothing'.  Then all you need to do is check if the variable (the one who's value was to be the named entity) "IsNot Nothing".  If it passes this test you can use it as planned.  If it fails this test, you can use a MsgBox() or MessageBox.Show() to inform the user if you want and/or something like 'Return', or 'End Sub' to end the rule.

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE" :thumbs_up:.

Also, when you have time, please review & vote for these 'Ideas' I'd like to get implemented.

  • Add more capabilities to the 'Customize' dialog box (exe. Add Tab & Add Panel) Click Here
  • Constrain & Dimension Images In Assembly Sketches & Drawing Sketches (TitleBlocks & SketchedSymbols) Click Here
  • Save Section View Status In DesignViewRepresentation (So It Can Be Used In The Drawing) Click Here
  • Add SolidBodies Folder In iLogic Rule Editor Model Tab Click Here
  • Convert All Views To Raster Before Autosave Stores To 'OldVersions' Folder Click Here
  • SetDesignViewRepresentation - Fix limitations for DrawingView of a Part Click Here
  • Create DocumentSubTypeEnum Click Here
  • Add kRevisionTag or kDrawingRevisionTag to ObjectTypeEnum Click Here

Inventor 2020 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

Wesley Crihfield

EESignature

(Not an Autodesk Employee)