Imports System.IO
Imports System.Runtime.InteropServices
Module Example
<STAThread()> _
Sub Main()
Dim objApplication As SolidEdgeFramework.Application = Nothing
Dim objPartDocument As SolidEdgePart.PartDocument = Nothing
Dim objStudyOwner As SolidEdgePart.StudyOwner = Nothing
Dim objStudy As SolidEdgePart.Study = Nothing
Dim objConnectorOwner As SolidEdgePart.ConnectorOwner = Nothing
Dim objConnector As SolidEdgePart.FEAConnector = Nothing
Dim eConnectorType As SolidEdgePart.FEAConnectorTypeEnum_Auto
Dim dConnectorValue As Double = 100
Dim dSearchDistValue As Double = 0.000091
Dim dMinSearchDistValue As Double = 0.01
Dim dPenaltyValue As Double = 0.0
Dim dConnectorPosX As Double = 1.0
Dim dConnectorPosY As Double = 1.0
Dim dConnectorPosZ As Double = 1.0
Dim ColorConnectorSymbol As UInt32 = 16769024
Dim dSpacingFactor As Double = 0.145
Dim dSizeFactor As Double = 0.155
Dim dwConnectorProps As UInt32 = 0
Dim dConnectorSymSpacing As Double = 0.0
Dim dConnectorSymSize As Double = 0.0
Dim ePenetrationType As SolidEdgePart.FEAInitialPenetrationTypeEnum_Auto
Dim objMasterFaceArray(1) As SolidEdgeGeometry.Face
Dim objSlaveFaceArray(1) As SolidEdgeGeometry.Face
Try
OleMessageFilter.Register()
' Connect to Solid Edge
objApplication = Marshal.GetActiveObject("SolidEdge.Application")
objPartDocument = objApplication.ActiveDocument
objStudyOwner = objPartDocument.StudyOwner
objStudy = objStudyOwner.Item(1)
objStudy.GetConnectorOwner(objConnectorOwner)
eConnectorType = SolidEdgePart.FEAConnectorTypeEnum_Auto.eConnectorTypeGlue_Auto
ePenetrationType = SolidEdgePart.FEAInitialPenetrationTypeEnum_Auto.eCalculatedType_Auto
' Populate objMasterFaceArray & objSlaveFaceArray
objConnectorOwner.AddConnector(objMasterFaceArray, _
objSlaveFaceArray, _
eConnectorType, _
dConnectorValue, _
dSearchDistValue, _
dMinSearchDistValue, _
dPenaltyValue, _
dConnectorPosX, _
dConnectorPosY, _
dConnectorPosZ, _
ColorConnectorSymbol, _
dSpacingFactor, _
dSizeFactor, _
dwConnectorProps, _
dConnectorSymSpacing, _
dConnectorSymSize, _
ePenetrationType, _
objConnector)
Catch ex As Exception
Console.WriteLine(ex.Message)
Finally
OleMessageFilter.Revoke()
End Try
End Sub
End Module