AnsweredAssumed Answered

i Can't able to select the plane of a part  for matting

Question asked by Suresh Vijayan on May 2, 2016
Latest reply on May 5, 2016 by Suresh Vijayan

Hi All,

 

I  cant able to select the plane using selectBYID2  for mating,Used code is below Kindly help me to solve this problem

 

######################################################################################################################

 

 

        Dim TemplateName As String = "C:\Documents and Settings\All Users\Application Data\SolidWorks\SolidWorks 2012\templates\Assembly.asmdot"

        Dim swAssy As AssemblyDoc

        Dim ShaftFilePath As String = "C:\Documents and Settings\3dcad0723\Desktop\New Folder\EditedShaft.SLDPRT"

        Dim CouplingFilePath As String = "C:\Documents and Settings\3dcad0723\Desktop\New Folder\EditedCoupling.SLDPRT"

        'Dim DocExt As ModelDocExtension

 

 

        'Opening the parts Before Assembly

        SwApp.OpenDoc6(ShaftFilePath, 1, 0, "", iErrors, iWarnings)

        SwApp.OpenDoc6(CouplingFilePath, 1, 0, "", iErrors, iWarnings)

        'Opening the New Assembly

        swModel = SwApp.NewDocument(TemplateName, 0, 0, 0)

        swAssy = SwApp.ActiveDoc

 

 

 

 

        'Adding Component (Shaft part)

        swAssy.AddComponent(ShaftFilePath, 0, 0, 0)

 

 

        'Adding Component (Coupling Part) Three Times

        swAssy.AddComponent(CouplingFilePath, 0.2, 0, 0)

        swAssy.AddComponent(CouplingFilePath, 0.5, 0.2, 0)

        swAssy.AddComponent(CouplingFilePath, 0.8, 0.4, 0)

 

 

 

 

        'Mating Components

        swModel.ClearSelection2(True)

        'Selecting Planes Of all Components

        swModel.Extension.SelectByID2("Plane3@EditedShaft-1@Assem1", "PLANE", 0, 0, 0, False, 0, Nothing, 0)

        swModel.Extension.SelectByID2("Plane2@EditedCoupling-3@Assem1", "PLANE", 0, 0, 0, True, 0, Nothing, 0)

 

 

        '.Extension.SelectByID2("Plane3@EditedShaft-1@Assem1", "PLANE", 0, 0, 0, False, 0, Nothing, 0)

        'boolstatus = Part.Extension.SelectByID2("Plane2@EditedCoupling-3@Assem1", "PLANE", 0, 0, 0, True, 0, Nothing, 0)

 

 

        'AddMating

        swAssy.AddMate3(0, 0, False, 0, 0, 0, 0, 0, 0, 0, 0, False, iErrors)

 

##########################################################################################################################################

 

Thanks in Advance

 

SureshKumar

Outcomes