Welcome
Expand Getting StartedGetting Started
Expand SOLIDWORKS API HelpSOLIDWORKS API Help
Expand SOLIDWORKS Electrical API HelpSOLIDWORKS Electrical API Help
Expand SOLIDWORKS PDM Professional API HelpSOLIDWORKS PDM Professional API Help
Expand PDM Pro API Web ServicePDM Pro API Web Service
Expand FeatureWorks API HelpFeatureWorks API Help
Expand SOLIDWORKS Costing API HelpSOLIDWORKS Costing API Help
Expand SOLIDWORKS Document Manager API HelpSOLIDWORKS Document Manager API Help
Expand SOLIDWORKS Inspection API HelpSOLIDWORKS Inspection API Help
Expand SOLIDWORKS Routing API HelpSOLIDWORKS Routing API Help
Collapse SOLIDWORKS Simulation API HelpSOLIDWORKS Simulation API Help
Welcome
Functional Categories
Release Notes
Getting Started
Collapse SolidWorks.Interop.cosworks NamespaceSolidWorks.Interop.cosworks Namespace
Overview
Collapse InterfacesInterfaces
Expand ICosmosWorksICosmosWorks
Expand ICWBaseExcitationICWBaseExcitation
Expand ICWBeamBodyICWBeamBody
Expand ICWBeamManagerICWBeamManager
Expand ICWBearingConnectorICWBearingConnector
Expand ICWBearingLoadICWBearingLoad
Expand ICWBoltConnectorICWBoltConnector
Expand ICWBucklingStudyOptionsICWBucklingStudyOptions
Expand ICWCentriFugalForceICWCentriFugalForce
Expand ICWCompositeShellOptionsICWCompositeShellOptions
Expand ICWContactComponentICWContactComponent
Expand ICWContactManagerICWContactManager
Expand ICWContactSetICWContactSet
Expand ICWConvectionICWConvection
Expand ICWDampingOptionsICWDampingOptions
Expand ICWDistributedMassICWDistributedMass
Expand ICWDropTestResultOptionsICWDropTestResultOptions
Expand ICWDropTestSetupICWDropTestSetup
Expand ICWDropTestStudyOptionsICWDropTestStudyOptions
Expand ICWDynamicInitialConditionICWDynamicInitialCondition
Expand ICWDynamicStudyOptionsICWDynamicStudyOptions
Expand ICWEdgeWeldConnectorICWEdgeWeldConnector
Expand ICWElasticConnectorICWElasticConnector
Expand ICWFatigueEventICWFatigueEvent
Expand ICWFatigueStudyOptionsICWFatigueStudyOptions
Expand ICWForceICWForce
Expand ICWFrequencyStudyOptionsICWFrequencyStudyOptions
Expand ICWGravityICWGravity
Expand ICWHeatFluxICWHeatFlux
Expand ICWHeatPowerICWHeatPower
Expand ICWJointsICWJoints
Expand ICWLinkageRodICWLinkageRod
Expand ICWLinkConnectorICWLinkConnector
Expand ICWLoadCaseManagerICWLoadCaseManager
Expand ICWLoadsAndRestraintsICWLoadsAndRestraints
Expand ICWLoadsAndRestraintsManagerICWLoadsAndRestraintsManager
Expand ICWMassPropertiesManagerICWMassPropertiesManager
Expand ICWMaterialICWMaterial
Expand ICWMeshICWMesh
Expand ICWMeshControlICWMeshControl
Expand ICWModelDocICWModelDoc
Expand ICWMultipleComponentContactsEditManagerICWMultipleComponentContactsEditManager
Expand ICWMultipleContactSetsEditManagerICWMultipleContactSetsEditManager
Expand ICWNonLinearStudyOptionsICWNonLinearStudyOptions
Expand ICWPinConnectorICWPinConnector
Expand ICWPlotICWPlot
Expand ICWPressureICWPressure
Expand ICWRadiationICWRadiation
Expand ICWRemoteLoadICWRemoteLoad
Expand ICWRestraintICWRestraint
Expand ICWResultsICWResults
Expand ICWResultsProbeManagerICWResultsProbeManager
Expand ICWRigidConnectorICWRigidConnector
Expand ICWRunSpecStudiesRunMeshOptionsICWRunSpecStudiesRunMeshOptions
Expand ICWRunStudiesResultsICWRunStudiesResults
Expand ICWShellICWShell
Expand ICWShellManagerICWShellManager
Expand ICWSolidBodyICWSolidBody
Expand ICWSolidComponentICWSolidComponent
Expand ICWSolidManagerICWSolidManager
Expand ICWSpotWeldConnectorICWSpotWeldConnector
Expand ICWSpringConnectorICWSpringConnector
Expand ICWStaticStudyOptionsICWStaticStudyOptions
Expand ICWStudyICWStudy
Expand ICWStudyManagerICWStudyManager
Expand ICWStudyResultOptionsICWStudyResultOptions
Expand ICWTemperatureICWTemperature
Expand ICWThermalStudyOptionsICWThermalStudyOptions
Expand ICWTopologyDemoldControlICWTopologyDemoldControl
Expand ICWTopologyDisplacementConstraintICWTopologyDisplacementConstraint
Expand ICWTopologyFactorOfSafetyConstraintICWTopologyFactorOfSafetyConstraint
Expand ICWTopologyFrequencyConstraintICWTopologyFrequencyConstraint
Expand ICWTopologyMassConstraintICWTopologyMassConstraint
Expand ICWTopologyMinimizeMaximumDisplacementGoalICWTopologyMinimizeMaximumDisplacementGoal
Expand ICWTopologyPreservedRegionControlICWTopologyPreservedRegionControl
Expand ICWTopologyStressConstraintICWTopologyStressConstraint
Expand ICWTopologyStudyManagerICWTopologyStudyManager
Expand ICWTopologyStudyOptionsICWTopologyStudyOptions
Expand ICWTopologySymmetryControlICWTopologySymmetryControl
Expand ICWTopologyThicknessControlICWTopologyThicknessControl
Expand ICWTrendTrackerICWTrendTracker
Expand SOLIDWORKS Sustainability API HelpSOLIDWORKS Sustainability API Help
Expand SOLIDWORKS Toolbox API HelpSOLIDWORKS Toolbox API Help
Expand SOLIDWORKS Utilities API HelpSOLIDWORKS Utilities API Help
Expand eDrawings API HelpeDrawings API Help
Expand DraftSight API HelpDraftSight API Help
Expand Lisp Programming BasicsLisp Programming Basics
Expand Lisp Functions OverviewLisp Functions Overview
Expand Lisp Functions ReferenceLisp Functions Reference
Expand Visual Lisp Compatible FunctionsVisual Lisp Compatible Functions
Hide Table of Contents
ICWLinkageRod Interface

Allows access to a linkage rod connector.

.NET Syntax

Visual Basic (Declaration) 
Public Interface ICWLinkageRod 
Visual Basic (Usage) 
Dim instance As ICWLinkageRod
C# 
public interface ICWLinkageRod 
C++/CLI 
public interface class ICWLinkageRod 

Example

'VBA

'=====================================

'Preconditions:

1. Open Public_Documents\SOLIDWORKS\SOLIDWORKS 2022\samples\Simulation Examples\mixedmesh-1.sldasm.
2. In SOLIDWORKS, select Tools > Add-ins > SOLIDWORKS Simulation.
3. Ensure the specified material library exists.
4. Open an Immediate window.

'Postconditions:

'1. Creates a Linkage rod-3.
'2. Meshes the model.
'3. Runs an analysis.
'4. Gets the results.
'5. Gets the linkage rod connector forces.
'6. Inspect the Immediate window for linkage rod connector forces.

'==========================================

Dim SwApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim COSMOSWORKSObj As CosmosWorksLib.COSMOSWORKS
Dim CWAddinCallBackObj As CosmosWorksLib.CWAddinCallBack
Dim ActiveDocObj As CosmosWorksLib.CWModelDoc
Dim StudyManagerObj As CosmosWorksLib.CWStudyManager
Dim StudyObj As CosmosWorksLib.CWStudy
Dim Study As CosmosWorksLib.CWStudy
Dim LoadsAndRestraintsManagerObj As CosmosWorksLib.CWLoadsAndRestraintsManager
Dim cwLinkageRod As CosmosWorksLib.cwLinkageRod
Dim CWMesh As CosmosWorksLib.CWMesh
Dim CWResult As CosmosWorksLib.CWResults
Dim errCode As Long
Dim strMaterialLib As String
Dim el As Double
Dim tl As Double
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long

Option Explicit

Sub main()

    Set SwApp = Application.SldWorks
    Set Part = SwApp.ActiveDoc

    Set CWAddinCallBackObj = SwApp.GetAddInObject("CosmosWorks.CosmosWorks")
    If CWAddinCallBackObj Is Nothing Then ErrorMsg2 SwApp, "CWAddinCallBackObj object not found", True
    Set COSMOSWORKSObj = CWAddinCallBackObj.COSMOSWORKS
    If COSMOSWORKSObj Is Nothing Then ErrorMsg2 SwApp, "COSMOSWORKSObj object not found", True

    'Set material Library
    strMaterialLib = SwApp.GetExecutablePath & "\lang\english\sldmaterials\solidworks materials.sldmat"

    'Get active document
    Set ActiveDocObj = COSMOSWORKSObj.ActiveDoc()
    If ActiveDocObj Is Nothing Then ErrorMsg2 SwApp, "No Active Document", True 'Get  the study
       
    'Activate the study
    Set StudyManagerObj = ActiveDocObj.StudyManager()
    If StudyManagerObj Is Nothing Then ErrorMsg2 SwApp, "StudyManagerObj object not there", True
   
    StudyManagerObj.ActiveStudy = 0
    Set Study = StudyManagerObj.GetStudy(0)
    If Study Is Nothing Then ErrorMsg2 SwApp, "Study not created", True
         
    'Select vertexes for End 1 and 2 of the linkage rod connector
    boolstatus = Part.Extension.SelectByRay(-0.231298527539886, 0.166575928167274, 0.458852915453974, -0.577381545199981, -0.577287712085548, -0.577381545199979, 3.6575436673129E-03, 3, True, 0, 0)
    boolstatus = Part.Extension.SelectByRay(4.88947738114092E-02, 0.414776469003414, 0.458852915453974, -0.577381545199981, -0.577287712085548, -0.577381545199979, 3.6575436673129E-03, 3, True, 0, 0)
   
    Set StudyObj = StudyManagerObj.GetStudy(0)
    Set LoadsAndRestraintsManagerObj = StudyObj.LoadsAndRestraintsManager()
    Dim DispatchObj1 As Object
    Set DispatchObj1 = Part.SelectionManager.GetSelectedObject6(1, -1)
    Dim DispatchObj2 As Object
    Set DispatchObj2 = Part.SelectionManager.GetSelectedObject6(2, -1)
    Dim DispArray As Variant
    DispArray = Array(DispatchObj1)
    Dim DispArray2 As Variant
    DispArray2 = Array(DispatchObj2)
   
    Set cwLinkageRod = LoadsAndRestraintsManagerObj.AddLinkageRod((DispArray), (DispArray2), 0, errCode)
    If errCode <> 0 Then ErrorMsg2 SwApp, "Linkage Rod creation failed", True
   
    Set cwLinkageRod = LoadsAndRestraintsManagerObj.GetLinkageRod("Linkage rod-3", errCode)
   
    'Start editing the linkage rod
    cwLinkageRod.BeginEdit
   
    'Set the joint type of End 1 and End 2
    cwLinkageRod.SetJointTypeAtEnd1 0
    cwLinkageRod.SetJointTypeAtEnd2 0

    'Set the hollow circular cross-section parameters
    Dim SectionParamsArray As Variant
    SectionParamsArray = Array(0.005, 0.0005)
    cwLinkageRod.SetSectionParams 1, (SectionParamsArray)
   
    'Set the material
    cwLinkageRod.MaterialSource = 1
    cwLinkageRod.SetLibraryMaterial strMaterialLib, "Alloy Steel"
    cwLinkageRod.IncludeMass = False
   
    'Stop editing
    errCode = cwLinkageRod.EndEdit()
    If errCode <> 0 Then ErrorMsg2 SwApp, "Linkage rod connector failed editing", True
   
    Part.ClearSelection2 True
   
    'Mesh
    Set CWMesh = StudyObj.Mesh
    If CWMesh Is Nothing Then ErrorMsg2 SwApp, "No mesh object", False
    CWMesh.Quality = 1
    CWMesh.MesherType = 0
    Call CWMesh.GetDefaultElementSizeAndTolerance(0, el, tl)
    errCode = StudyObj.CreateMesh(0, el, tl)
    If errCode <> 0 Then ErrorMsg2 SwApp, "Mesh failed", True
  
    'Run analysis
    errCode = StudyObj.RunAnalysis
    If errCode <> 0 Then ErrorMsg2 SwApp, "Analysis failed", True
       
    Part.GraphicsRedraw2

    'Get results
    Set CWResult = StudyObj.Results
    If CWResult Is Nothing Then ErrorMsg2 SwApp, "No results", False
     
    'Get linkage rod connector forces
    Dim Forc  As Variant
    Forc = CWResult.GetConnectorForces2(1, "Linkage rod-3", 0, errCode)

    Dim i As Integer
    For i = 0 To 10
       Debug.Print i & " : " & Forc(i)
    Next i
   
    If errCode <> 0 Then ErrorMsg2 SwApp, "No connector forces", True

   
End Sub
 
Function ErrorMsg2(SwApp As Object, Message As String, EndTest As Boolean)
    SwApp.SendMsgToUser2 Message, 0, 0
    SwApp.RecordLine "'*** WARNING - General"
    SwApp.RecordLine "'*** " & Message
    SwApp.RecordLine ""
    'If EndTest Then
        'End
    'End If
End Function

Remarks

This interface is only available with SOLIDWORKS Simulation Professional and Premium licenses.

For more information about linkage rod connectors, see the SOLIDWORKS user-interface help > Simulation > Loads and Restraints > Connectors topics.

Accessors

See Also



Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   ICWLinkageRod Interface
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:




x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2024 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.