Hi Zhen-Wei Tee, here’s a macro I use to clean up files almost daily.
I’ve modified it over the years from stuff I’ve found in the forums and adapted to my use.
It didn’t include surfaces until I saw this post and I thought I could use that function, too.
The macro actually hides all reference geometry, my definition of it anyway, rather than hitting the “Hide all” button.
Some of the functions are described and can be commented out if you don’t want that specific thing to happen.
Hope this helps,
Ray
PS: My apologies to the original authors, I’ve since gotten better at keeping credits in the macro.
Please let me know if you recognize your code and I’ll credit your name within the macro.
Found an error in the macro I posted. Working on it.
I found that the previous code would inadvertently hide a solid body.
The rest of the untested lines have now been commented out and it works as intended for me.
Uncomment a set of these lines to test behavior for a specific surface type.
If you’re going to be using linear patterns in an Assembly, keep in mind the default direction for the pattern. For example, quite a few of my Assemblies are concrete (with rebar) or guardrails. I always place my first rebar, posts, rails, etc on the left side, so when I use a linear pattern I don’t need to switch directions. It’s a little thing, but can add up if you have multiple patterns, and it’s generally just as easy to start on the left as the right.
This hardly counts as a most impressive trick. All the same, I did not make a new thread for this, and could not find a thread like, “What did you learn that you never knew before?”
Today I learned more lazy.
When entering today’s date into custom properties, I typed in the month and date and left out the year by mistake. The date field auto-filled the current calendar year. This is a tiny time saver which is multiplied by the many implemented uses today.
What about using the mid-plane relation between your perpendicular primary planes for a reference plane and then adding a coincident mate? I guess it would add another feature, but wonder if it would be more advantageous or if there are hidden drawbacks. I don’t know that I’ll have any use case to test either method out soon, but just curious if anyone would know offhand.
Maybe this is a silly “trick” to mention, but I think I use the space bar more than any shortcut for reorienting the model view. I use it so much that the SpaceMouse I have has become pretty obsolete (I might use it if it had more hotkeys I could configure).
I’m also a fan of:
Design Checker tool (especially great for drawing consistency)
Symmetry Check tool
Creating a Config for ‘simplified’ geometry (suppress any features not needed/visible)
Embossing 3D printed parts with PDM file version to track the physical versions
Design History (especially looking at feature properties to see who made the last changes and/or when)
Zebra stripes
Surfacing tools (they can be a headache but also be a tremendous help)
Best of all, I love the “Please wait, Solidworks is busy” message, since it’s my reminder that I should stop every so often to stretch or go get some water.
I’ve done that before, both in assembly reference planes and in component reference planes. It is also very stable, and also available in lightweight mode because it is a reference entity. I prefer parallel to coincident for axial orientation.
Early on as a novice, I received a series of van stone flange parts which had their hole pattern in a diamond (+) instead of a square (x). I already began using this in projects, then later added mid-plane 45º planes to use as substitute-top and substitute-right planes. It remains this way, and mates stably even if this is an outlier in the library as not compliant with import standards developed later.
Maybe a bit late, but I encountered the same problem as you described. I’ve found a macro which could change the width of the feature manager design tree. The only downside was that if you have placed the property manager side by side with the feature manager, it would only change the feature manager width. So I started looking into docking the property manager with VBA and adjusted the code so that the property manager first docks to the original location and then change the width. This will change the width of both the property and feature manager. After this step it wil dock the windows side by side again. Lastly it will change the width of the feature manager design tree once more. Because the windows are side by side, the width of the property manager will not change. There is a standard width in this code of 350 pixels for both windows which can be adjusted to your preference independently.
Macro code:
'----------------------------------------
'
' Preconditions: Model document is open.
'
' Postconditions: Width of featuremanager design tree and property manager are controlled by WidthFeat and WidthProp (default 350)
' Property manager is docked side by side with the featuremanager (position 2)
'
'
' Notes: When you work with the property manager side by side with the feature manager design tree
' sometimes the width of this window will grow over time. You can adjust the width of the feature
' manager design tree, but this will not chanage the width of the property manager when docked side by side.
' This macro first docks the property manager on the original position, then changes width and docks it side by side.
' After docking it will change the width of the feature manager once more, if you would like a different width of this.
'
' If you want to change the docking location you can chanage the number at the end of the last line.
' 0 = original, 1 = bottom left, 2 = side by side
'
'----------------------------------------
Option Explicit
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim nWidth As Long
Dim nRetVal As Long
Dim WidthProp As Integer
Dim WidthFeat As Integer
Dim Part As Object
Set swApp = CreateObject("SldWorks.Application")
Set swModel = swApp.ActiveDoc
Set Part = swApp.ActiveDoc
Dim myModelView As Object
Set myModelView = Part.ActiveView
myModelView.FrameState = swWindowState_e.swWindowMaximized
'Property manager is docked on original location, same place as feature manager design tree
swApp.SetUserPreferenceIntegerValue swUserPreferenceIntegerValue_e.swPropertyMgrDockingState, 0
'Reading old width
nWidth = swModel.GetFeatureManagerWidth
'Writing width of property manager
WidthProp = 350
nRetVal = swModel.SetFeatureManagerWidth(nWidth / nWidth * WidthProp)
'docking property manager side by side with feature manager design tree (Position 2)
swApp.SetUserPreferenceIntegerValue swUserPreferenceIntegerValue_e.swPropertyMgrDockingState, 2
'Writing width of feature manager
WidthFeat = 350
nRetVal = swModel.SetFeatureManagerWidth(nWidth / nWidth * WidthFeat)
End Sub
Because I find none of the docked property manager options favorable, I have it undocked and out to the left of the parent solidworks window. It’s a long way over to it but it is the only option that doesn’t hide the feature/assembly tree AND is consistent. I can get used to nuisance behavior if it’s consistent but random nuisance behavior can be frustrating and counter productive.
Over the past few months I find myself coming back to this thread over and over again. There’s just too much knowledge here to pass up! On a related note, you can double click a face in a part or an assembly, and it’ll show all the driving dimensions. I don’t know how fast you are with the measure tool, but this has came in handy quite a few times for a quick reference.
On another note, double clicking a feature just selects the whole part.
Every time I’ve used it I get a mixed reaction and I tend to turn it off because it’s not always clear, and I feel like I spend too much time trying to dissect using it or I rarely need it.
BUT, it’s a good thing to have for clues if you are trying to preserve or workaround a parent/child issue.
. . . or if you left click on it you can select “Configure dimension” from the drop-down to bring up a simplified design table, which can be very helpful if you work with configurations.
Just stumbled upon this again when trying out some tricks Dwight showed us here and I’m glad I remembered:
Right clicking a sketch pattern gives you the option to edit it:
2022-06-03 09_55_42-.png
Edit:
As the master himself pointed out:
I sometimes get tripped up by right-clicking the relation, which doesn’t work. To be clear, you have to right-click a sketch element in the pattern, not the pattern relation icon.