Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Does anyone have an exampl on how the create an ALIGN OFFSET constraint in VBA (I am automating from MS Excel)
My code fails when I try to supply an Offset:
Set asmItem = assemblyModelItemOwner.GetItemByName(EpfcModelItemType.EpfcITEM_SURFACE, assemblyDatums(i))
Set compItem = componentModelItemOwner.GetItemByName(EpfcModelItemType.EpfcITEM_SURFACE, componentDatums(i))
Set ids = New Cintseq
Dim OCMAssembly As New CMpfcAssembly
Set path = OCMAssembly.CreateComponentPath(assembly, ids)
Dim oCMSelect As New CMpfcSelect
Set asmSelect = oCMSelect.CreateModelItemSelection(asmItem, path)
Set compSelect = oCMSelect.CreateModelItemSelection(compItem, Nothing)
Dim oCCComponentConstraint As New CCpfcComponentConstraint
Set constraint = oCCComponentConstraint.Create(EpfcComponentConstraintType.EpfcASM_CONSTRAINT_ALIGN_OFF)
constraint.AssemblyReference = asmSelect
constraint.ComponentReference = compSelect
''constraint.Offset = 10 '' <--- CODE FAILS HERE
Call constraints.Insert(constraints.Count, constraint)
Solved! Go to Solution.
Solution is to convert the value to a double:
constraint.Offset = CDbl(100)
Solution is to convert the value to a double:
constraint.Offset = CDbl(100)