×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

macro about select loop

macro about select loop

macro about select loop

(OP)
hello
i have a question
i want to write a macro about selecting outer loop in a sketch
how i can select a loop in a sketch???
when i use "loop.select" my solidworks error and exits the program

this is my code :

Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSeg As SldWorks.SketchSegment
Dim swSketch As SldWorks.Sketch
Dim swSketchMgr As SldWorks.SketchManager
Dim swLoop As SldWorks.Loop2
Dim swReg As SldWorks.SketchRegion
Dim vLoop As Variant
Dim vReg As Variant
Dim swEdge As SldWorks.Edge
Dim vEdge As Variant
Dim vEdgeArr As Variant
Dim swFeat As SldWorks.Feature
Dim myPart As SldWorks.PartDoc
Dim swSelData As SldWorks.SelectData
Dim swEnt As SldWorks.Entity
Dim swSelMgr As SldWorks.SelectionMgr

Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set myPart = swModel
Set swSelMgr = swModel.SelectionManager
Set swFeat = myPart.FeatureByName("Sketch1")
Set swSketch = swFeat.GetSpecificFeature2()

vReg = swSketch.GetSketchRegions
For i = LBound(vReg) To UBound(vReg)
Set swReg = vReg(i)
Set swLoop = swReg.GetFirstLoop

vEdgeArr = swLoop.GetEdges

For j = LBound(vEdgeArr) To UBound(vEdgeArr)
Set swEdge = vEdgeArr(i)


Next
Next
Debug.Print swLoop.Select(swEdge, True, swSelData)
End Sub

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources