Hello i tried this rule again as is so just pasted it and i get 2x error on this code what am i doing wrong?
Error1 (on the last 3 lines)
Argument not specified for parameter 'EntityTwo' of 'Public function AddFlushConstraint...
Error2 (on the last 3 lines)
Comma,'(', or a valid expression continuation expected.
'get file to place
Dim oFileDlg As inventor.FileDialog = Nothing
InventorVb.Application.CreateFileDialog(oFileDlg)
oFileDlg.Filter = "Inventor Files (*.iam;*.ipt)|*.iam;*.ipt|All Files (*.*)|*.*"
oFileDlg.DialogTitle = "Select a File"
oFileDlg.InitialDirectory = ThisDoc.Path
oFileDlg.CancelError = True
On Error Resume Next
oFileDlg.ShowOpen()
If Err.Number <> 0 Then
MessageBox.Show("File not chosen.", "Dialog Cancellation")
Return
ElseIf oFileDlg.FileName <> "" Then
oFile = oFileDlg.FileName
End If
' set a reference to the assembly component definintion.
' This assumes an assembly document is open.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
' Set a reference to the transient geometry object.
Dim oTG As TransientGeometry
oTG = ThisApplication.TransientGeometry
' Create a matrix.
Dim oMatrix As Matrix
oMatrix = oTG.CreateMatrix
'place an instance of the component
Dim oOccurrence As ComponentOccurrence
oOccurrence = oAsmCompDef.Occurrences.Add(oPath & oFile, oMatrix)
' Set the translation portion of the matrix so the part will be
'positioned at the co-ordinates
oMatrix.SetTranslation(oTG.CreateVector(0, 0, 0))
'Iterate through all of the occurrences and ground them.
For Each oOccurrence In oAsmCompDef.Occurrences
'check for and skip virtual components
If Not TypeOf oOccurrence.Definition Is VirtualComponentDefinition Then
oOccurrence.Grounded = False
Else
End If
Next
'Get the plane from the selected part.
' The work plane obtained is in the context of the part, not the assembly.
Dim oPartPlane1 As WorkPlane
Dim oPartPlane2 As WorkPlane
Dim oPartPlane3 As WorkPlane
oPartPlane1 = oOccurrence.Definition.WorkPlanes.Item(1) 'Component YZ Plane
oPartPlane2 = oOccurrence.Definition.WorkPlanes.Item(2) 'Component XZ Plane
oPartPlane3 = oOccurrence.Definition.WorkPlanes.Item(3) 'Component XY Plane
'Get the plane from the assembly
Dim oAsmPlane1 As WorkPlane
Dim oAsmPlane2 As WorkPlane
Dim oAsmPlane3 As WorkPlane
oAsmPlane1 = oAsmCompDef.WorkPlanes.Item(1) 'Assembly YZ Plane
oAsmPlane2 = oAsmCompDef.WorkPlanes.Item(2) 'Assembly XZ Plane
oAsmPlane3 = oAsmCompDef.WorkPlanes.Item(3) 'Assembly XY Plane
' Create proxies for the work planes of the part.
' The proxies represent the part work planes in the context of the assembly.
Dim oAsmPlane4 As WorkPlaneProxy
Dim oAsmPlane5 As WorkPlaneProxy
Dim oAsmPlane6 As WorkPlaneProxy
oOccurrence.CreateGeometryProxy(oPartPlane1, oAsmPlane4)
oOccurrence.CreateGeometryProxy(oPartPlane2, oAsmPlane5)
oOccurrence.CreateGeometryProxy(oPartPlane3, oAsmPlane6)
'' Create the constraint using the part work plane proxies.
oConstraint = oAsmCompDef.Constraints.AddFlushConstraint(oAsmPlane1, oAsmPlane4, 0)
oConstraint = oAsmCompDef.Constraints.AddFlushConstraint(oAsmPlane2, oAsmPlane5, 0)
oConstraint = oAsmCompDef.Constraints.AddFlushConstraint(oAsmPlane3, oAsmPlane6, 0)