Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create and pattern axis in a cut 7

Status
Not open for further replies.

GhostTX

Mechanical
Jun 13, 2006
8
Alright...something I did all the time in Pro/E, but for the life of me can't figure out how to do it in SW.

Problem: I have an assembly that utilizes carriage bolts. I used to create my square cuts and would pop an axis point in the middle of it. This way, when I assembled the bolts (which had an axis), it was a mate to surface and axis to axis mate. Ref Pattern the bolt, and boom...all the holes are filled with bolts.

With SolidWorks...I can't find a way to create an axis in a sketch. I can create an axis utilizing a sketched point, but the axis won't pattern.

So...how does one create a pattern-able axis in SW OR is there a preferred, simple SolidWorks way to assemble a cylindrical part into a square hole?
 
Replies continue below

Recommended for you

You could use just the sketch point, mate that concentric to the bolt cilinder, then mate the bolt mount face coincident to the face with the hole

Stefan Hamminga
EngIT Solutions
CSWP/Mechanical designer/AI student
 
To mate the square head to the square hole:
At the part level, I draw a line midpoint to midpoint of the square cut. I then put a point midpoint of that line. This way, if my square cut changes, the center point stays centered. I then mate the axis of the carriage bolt to that point. Finally I add a coincident mate between parts, and also a parallel mate to sides to lock it.


Flores
SW06 SP4.1
 
Another option is the Width mate located under Advanced mates. You'll still need 3 mates total though (2 widths and coincident), but if you don't have a sketch or point to use for the axis, this would work.

And why would you need to pattern the axis to all holes? You just mate the bolt to the master hole, then use a Derived Component Pattern to populate the rest. Provided the holes in the part were created with a pattern feature.

Jason

UG NX2.02.2 on Win2000 SP3
SolidWorks 2006 SP4.0 on WinXP SP2
 
I always have a problem locating components to a hole pattern. How do you figure out which point is the first one to which you should mate the starting component?
"my point, and I did have one . . ."

--
Hardie "Crashj" Johnson
SW 2005 SP 4.0 (reluctant to change)
Nvidia Quadro FX 1000
AMD Athalon 1.8 GHz 2 Gig RAM

 
The one with the dimensions attached is the "seed" hole.

[cheers]
Helpful SW websites FAQ559-520
How to get answers to your SW questions FAQ559-1091
 
It's a little tougher to find the seed hole if you're using a hole wizard feature as the feature-based pattern pattern feature. The seed hole in that case is the first point you placed for the HW feature. However, once you've finished the feature it's easy to forget which was the first point you placed.
 
just double click one of the patterned feature faces, the one that does not turn green is the one you are looking for.

Stefan Hamminga
EngIT Solutions
CSWP/Mechanical designer/AI student
 
You get get into the habit of coloring the face of the seed hole differently for future reference.

Jason

UG NX2.02.2 on Win2000 SP3
SolidWorks 2006 SP4.0 on WinXP SP2
 
Stefan,
That only works if your holes are a pattern (linear, sketch driven, circular, etc). If your holes are all in one Hole Wizard feature (which you can use as a base feature for a component pattern) then they will all highlight with a double-click.

Something I've been meaning to do for a while is write a macro that will highlight the first hole of a hole wizard feature. I finally got up the gumption to do so.

This macro allows either pre- or post-selection of a hole wizard feature either in the feature tree or by one of its faces. It will select the first hole of that wizard feature. Any component mated with that hole can be patterned using the hole wizard feature as the pattern's base feature.

Code:
Sub FindFirstHole()
Dim swApp As SldWorks.SldWorks
Dim SelMgr As SldWorks.SelectionMgr
Dim swDoc As SldWorks.ModelDoc2
Dim SelType As SwConst.swSelectType_e
Dim sMsg As String
Dim i As Long
Dim fSelFeature As SldWorks.Feature
Dim myHwFeature As SldWorks.Feature
Dim FaceArray As Variant

Const MINSELECTIONS = 1

Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc
Set SelMgr = swDoc.SelectionManager

If SelMgr.GetSelectedObjectCount2(-1) > 1 Then
    MsgBox "Please select one Wizard hole"
    swDoc.ClearSelection2 True
End If

If SelMgr.GetSelectedObjectCount2(-1) < 1 Then
    While SelMgr.GetSelectedObjectCount2(-1) < 1
        DoEvents 'Wait
    Wend
End If

If SelMgr.GetSelectedObjectType3(1, -1) = swSelBODYFEATURES Then
    Set fSelFeature = SelMgr.GetSelectedObject6(1, -1)
ElseIf SelMgr.GetSelectedObjectType3(1, -1) = swSelFACES Then
    Set fSelFeature = SelMgr.GetSelectedObject6(1, -1).GetFeature
Else
    MsgBox "Select a hole wizard feature to use this function"
    Exit Sub
End If

If fSelFeature.GetTypeName <> "HoleWzd" Then
    MsgBox "Feature is not hole wizard"
    Exit Sub
End If

FaceArray = fSelFeature.GetFaces

'select the first face in the array.  It's probably the first hole.
FaceArray(0).Select False

End Sub
 
That's a neat macro. [thumbsup2] Are the "Please select ..." Message Boxes supposed to appear? They didn't on my machine.

Also, is there any way to change the highlight colour to something more visible? I tested it on a thin plate with CSK holes and only the "drilled" hole portion was highlighted the usual dark green colour. Trouble is that portion was very thin and did not stand out very well.

[cheers]
Helpful SW websites FAQ559-520
How to get answers to your SW questions FAQ559-1091
 
The messages will only show up if (a) you have more than one item pre-selected when you run the macro or (b) the item either pre- or post-selected is not a hole wizard or a face belonging to a hole wizard.

All this macro does to highlight the face is select it. In order to change the color it would have to either change the actual face color or change your system setting for selection color. There are a couple of ways to help find that first hole. One would be to add the line

swDoc.ViewZoomToSelection

just before the End Sub. I think that's the right syntax. I won't be sitting in front of SW until next Wednesday. (Happy 4th everybody! Happier 4th to those in the US who are off work! :))

The other way to help the hole stand out would be to select the edges of that face along with the face itself, since edges highlight with a bolder line than faces. It would just be a few more lines of code to find all edges belonging to that face and add them to the selection set. I'll add that sometime next week unless someone beats me to it. :)
 
As promised, here is the code with the addition of selecting all edges belonging to the face that was selected previously. The last line is also a "View->Zoom To Selection" which you may or may not want to comment out. Enjoy!

Code:
Sub FindFirstHole()
Dim swApp As SldWorks.SldWorks
Dim SelMgr As SldWorks.SelectionMgr
Dim swDoc As SldWorks.ModelDoc2
Dim SelType As SwConst.swSelectType_e
Dim sMsg As String
Dim i As Long
Dim fSelFeature As SldWorks.Feature
Dim myHwFeature As SldWorks.Feature
Dim FaceArray As Variant
Dim EdgeArray As Variant

Const MINSELECTIONS = 1

Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc
Set SelMgr = swDoc.SelectionManager

If SelMgr.GetSelectedObjectCount2(-1) > 1 Then
    MsgBox "Please select one Wizard hole"
    swDoc.ClearSelection2 True
End If

If SelMgr.GetSelectedObjectCount2(-1) < 1 Then
    While SelMgr.GetSelectedObjectCount2(-1) < 1
        DoEvents 'Wait
    Wend
End If

If SelMgr.GetSelectedObjectType3(1, -1) = swSelBODYFEATURES Then
    Set fSelFeature = SelMgr.GetSelectedObject6(1, -1)
ElseIf SelMgr.GetSelectedObjectType3(1, -1) = swSelFACES Then
    Set fSelFeature = SelMgr.GetSelectedObject6(1, -1).GetFeature
Else
    MsgBox "Select a hole wizard feature to use this function"
    Exit Sub
End If

If fSelFeature.GetTypeName <> "HoleWzd" Then
    MsgBox "Feature is not hole wizard"
    Exit Sub
End If

FaceArray = fSelFeature.GetFaces

'select the first face in the array.  It's probably the first hole.
FaceArray(0).Select False

EdgeArray = FaceArray(0).GetEdges
For i = 0 To UBound(EdgeArray)
    EdgeArray(i).Select True
Next i

swDoc.ViewZoomToSelection

End Sub
 
Perfect ... Thanks again. [2thumbsup]

[cheers]
Helpful SW websites FAQ559-520
How to get answers to your SW questions FAQ559-1091
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor