Message 1 of 3
Positional Rep API Broken: SetRelationshipValueOverride
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
With the revision to positional rep/constraint API, we are now no long able to pass parameter names to the relationship value override string, and are thus stuck using static values.
see:
To use the code below,
Make only 2 constraints in a document. Make the 2nd one an insert.
Add a parameter named "CYL_STROKE".
Ensure no positional rep named "EXTENDED" Exists.
Run code & watch it fail.
However, swap the commented out line to the one above it, and it works fine.
From there you can go back in and change the relationship override value to a "CYL_STROKE" to witness that the functionality should be available.
This was discovered when modifying old code that worked with the previous pos rep system that worked perfectly fine.
Dim oAsmCompDef As AssemblyComponentDefinition = ThisApplication.ActiveDocument.ComponentDefinition Dim oStroke As Integer = 30 Dim oInsert1 As AssemblyConstraint = oAsmCompDef.Constraints.Item(2) Dim oPosReps As PositionalRepresentations = oAsmCompDef.RepresentationsManager.PositionalRepresentations Dim oOcc As ComponentOccurrence Dim oPosRep1 As PositionalRepresentation = oPosReps.Add("EXTENDED") With oPosRep1 .SetRelationshipSuppressionOverride(oInsert1, False) .SetRelationshipValueOverride(oInsert1, RelationshipValueTypeEnum.kRelationshipOffsetValue, "CYL_STROKE") ' .SetRelationshipValueOverride(oInsert1, RelationshipValueTypeEnum.kRelationshipOffsetValue, oStroke & " in") End With
--------------------------------------
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
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