×
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

Face selection using the record macro feature

Face selection using the record macro feature

Face selection using the record macro feature

(OP)
Hi all, I have a number of parts that need the same five bends added to them. I want to create a macro to accomplish this. To simplify this, this is what I need to do:

1. Take my flat sheet metal part that has five sketches each containing a bend line and select Sketch3 (my first bend).
2. Select the Sketched Bend feature.
3. Select a face that the bend occurs on. This is what I am having troubles with.
4. Enter the angle of bend.
5. Repeat.

Should be pretty simple but when recording this macro clicking on this face comes up with merely a coordinate of where I clicked as far as I know. I am not very proficient with VB so I do not know what to input as code to select this face rather than a coordinate as my parts get bigger and bigger as I go along. Also the side of the face that you click on relative to the bend will determine what face will be fixed in space when this bend is performed and which will be folded (this is critical, as - if the face with my other sketches moves my sketches will not serve as bend lines any more).

Heres the code:

Sub main()

Set swApp = Application.SldWorks
Dim CBAObject As Object
Dim myFeature As Object
Dim myModelView As Object
Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID2("Sketch3", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("", "FACE", 1.161032084972, 1.106646697417, 0, True, 0, Nothing, 0)
Set myFeature = Part.FeatureManager.InsertSheetMetal3dBend(0.629144219109, True, 0.0037084, False, 0, CBAObject)
boolstatus = Part.Extension.SelectByID2("Sketch4", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("", "FACE", 1.161032084972, 1.106646697417, 0, True, 0, Nothing, 0)
Set myFeature = Part.FeatureManager.InsertSheetMetal3dBend(0.9429138259244, True, 0.0037084, False, 0, CBAObject)
boolstatus = Part.Extension.SelectByID2("Sketch5", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("", "FACE", 1.144363998393, 1.391540631547, 0, True, 0, Nothing, 0)
Set myFeature = Part.FeatureManager.InsertSheetMetal3dBend(1.570796326795, True, 0.0037084, True, 0, CBAObject)
boolstatus = Part.Extension.SelectByID2("Sketch6", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("", "FACE", 1.117725433927, 1.789351811615, 0, True, 0, Nothing, 0)
Set myFeature = Part.FeatureManager.InsertSheetMetal3dBend(1.570184141564, True, 0.0037084, True, 0, CBAObject)
boolstatus = Part.Extension.SelectByID2("Sketch7", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("", "FACE", 1.117725433927, 1.789351811615, 0, True, 0, Nothing, 0)
Set myFeature = Part.FeatureManager.InsertSheetMetal3dBend(1.570184141564, True, 0.0037084, False, 0, CBAObject)

End Sub


Here's the Files:

Unbent Part:

http://files.engineering.com/getfile.aspx?folder=d368fa61-9b7e-49e0-9878-ca53fc471926&file=Flat_Pattern_With_Sketches.SLDPRT

Bent Part:

http://files.engineering.com/getfile.aspx?folder=d368fa61-9b7e-49e0-9878-ca53fc471926&file=Bent_Part.SLDPRT

Macro:

http://files.engineering.com/getfile.aspx?folder=b48b5de9-657d-4da8-adf4-16647ea722e3&file=Bend.swp

RE: Face selection using the record macro feature

(OP)
Can anyone confirm whether or not they have looked into this?

RE: Face selection using the record macro feature

(OP)
I posted on the SW forums last week and still have no responses unfortunately.  

RE: Face selection using the record macro feature

(OP)
.

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