Positional Rep API Broken: SetRelationshipValueOverride

Positional Rep API Broken: SetRelationshipValueOverride

MechMachineMan
Advisor Advisor
338 Views
2 Replies
Message 1 of 3

Positional Rep API Broken: SetRelationshipValueOverride

MechMachineMan
Advisor
Advisor

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
0 Likes
339 Views
2 Replies
Replies (2)
Message 2 of 3

MechMachineMan
Advisor
Advisor

Has anyone had the chance to look at this? Or is there a better channel for discussion on this issue?


--------------------------------------
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
0 Likes
Message 3 of 3

HermJan.Otterman
Advisor
Advisor

hello MechMachine,

 

I didnot use this in a version before 2016, but don't you need to use the value of the parameter?

 

the second line works for me to, also without the unit.

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


0 Likes