Message 1 of 2
UCS to UCS Constraint SUb-Assembly to Part

Not applicable
04-25-2021
04:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
In the Assembly file, I wanted to make a constraint set (UcsToUcs) from a subassembly ucs to a part ucs.
When I run the code it says "Public member 'Constraints' on type 'PartComponentDefinition' not found."
Please see the snapshot and sample files in version2020.
Thank you.
Dim oSubAsm As AssemblyDocument = ThisAssembly.Document Dim wfUCSs As UserCoordinateSystems 'Create a list for skUCS For Each oRefDoc As Document In oSubAsm.ReferencedDocuments 'Get the wireframe If oRefDoc.DocumentType = Inventor.DocumentTypeEnum.kPartDocumentObject AndAlso oRefDoc.DisplayName.Contains("wireframe") Then Dim wfDoc As PartDocument = oRefDoc wfUCSs = wfDoc.ComponentDefinition.UserCoordinateSystems End If Next For Each oRefDoc As Document In oSubAsm.ReferencedDocuments If oRefDoc.DocumentType = Inventor.DocumentTypeEnum.kAssemblyDocumentObject Dim oAsmDoc As AssemblyDocument = oRefDoc For Each oPartDoc As PartDocument In oAsmDoc.ReferencedDocuments For Each wfUCS As UserCoordinateSystem In wfUCSs If oPartDoc.DisplayName.Contains(wfUCS.Name) Then MsgBox("Yes") Dim oCompDef As PartComponentDefinition = oPartDoc.ComponentDefinition Dim oUCS As UserCoordinateSystem = oCompDef.UserCoordinateSystems.Item("UCS_Origin") Dim oMate As FlushConstraint 'Public member 'Constraints' on type 'PartComponentDefinition' not found 'Maybe because the parts are inside the sub-assembly
oMate = oCompDef.Constraints.AddFlushConstraint(oUCS, wfUCS, 0) End If Next Next End If Next