Color Out of Control
Color Out of Control
(OP)
We?ve got three engineers here running Solidworks 2005 and all of us have had major problems with colors, even going back a few versions and a few different computers.
The basic problem is, it?s easy to color a part for the first time, but then it?s difficult to impossible to UNcolor the part later. Sometimes the best we can do is just change the color, and even that is hit and miss. And when you put these parts into assemblies, there?s no telling what color they?ll end up being, and trying to fix the colors is often a waste of time as when you fire up the assembly the next day, the colors are all wacked again.
I went to the SolidWorks World convention in Orlando in January, and presented this problem to an ?Ask the Experts? session. They were skeptical it was even a problem, so I had them make a simple box, color it via the ?Edit Color? icon, then try to via the ?Color & Optics Window? get the ?Remove Color? button to become available. They ceased being skeptics.
I have been able to, via about 12 lengthy and tedious different ways, been able to SOMETIMES remove the color, but the time spent jumping thru these hoops for each part in an assembly is insane, and sometimes none of the work-arounds work at all.
Does ANYBODY have a sure-fire solution for this irritating and time consuming problem??? Does anybody have a 3 or 4 step process that is guaranteed to remove the color from parts and keep it off???
--Mark Smith
Cla-Val, Newport Beach, California
The basic problem is, it?s easy to color a part for the first time, but then it?s difficult to impossible to UNcolor the part later. Sometimes the best we can do is just change the color, and even that is hit and miss. And when you put these parts into assemblies, there?s no telling what color they?ll end up being, and trying to fix the colors is often a waste of time as when you fire up the assembly the next day, the colors are all wacked again.
I went to the SolidWorks World convention in Orlando in January, and presented this problem to an ?Ask the Experts? session. They were skeptical it was even a problem, so I had them make a simple box, color it via the ?Edit Color? icon, then try to via the ?Color & Optics Window? get the ?Remove Color? button to become available. They ceased being skeptics.
I have been able to, via about 12 lengthy and tedious different ways, been able to SOMETIMES remove the color, but the time spent jumping thru these hoops for each part in an assembly is insane, and sometimes none of the work-arounds work at all.
Does ANYBODY have a sure-fire solution for this irritating and time consuming problem??? Does anybody have a 3 or 4 step process that is guaranteed to remove the color from parts and keep it off???
--Mark Smith
Cla-Val, Newport Beach, California






RE: Color Out of Control
Don't use the color button at the top to change colors and don't color the parts/surfaces within the materials editor.
Go to Tools > Options > Document Properties > Colors, click the Shading item, and change the color there. Always reliable. There is no such option as "remove color" in this section, but the part must have some sort of color to be displayed--therefore, with this control, it's not an issue.
For surfaces, select the surfaces, right-click and click the Properties item under the Face item. This will allow you to make color changes to specific surfaces different from the whole part color. To remove the colors on surfaces, do the same thing, then click "remove color" in this area.
Jeff Mowry
www.industrialdesignhaus.com
Reality is no respecter of good intentions.
RE: Color Out of Control
RE: Color Out of Control
Best Regards,
Jon
Challenges are what makes life interesting; overcoming them is what makes life meaningful.
Solidworks 2005 SP1.1
RE: Color Out of Control
This seams to strip the added colour
RE: Color Out of Control
Regards,
Scott Baugh, CSWP
3DVision Technologies
www.3dvisiontech.com
www.scottjbaugh.com
FAQ731-376
FAQ559-716 - SW Fora Users
RE: Color Out of Control
--------------------
OPTIONS Icon / DOCUMENT PROPERTIES Tab / COLORS
Check the "Ignore Feature Colors"
------------------------
If this works, it will save going thru every single feature and undoing its messed up color.
RE: Color Out of Control
Making the best use of this Forum. FAQ559-716
How to get answers to your SW questions. FAQ559-1091
Helpful SW websites every user should be aware of. FAQ559-520
RE: Color Out of Control
I agree with CorBlimeyLimey. To further this, I took those 2 macros, combined them into one and added to it a little bit, see the code below. This macro removes colors from faces, features, and all bodies in the part file.
One thing I'd add is *not* to change color/transparency settings of a part from within an assembly file. The only workaround I have for this is not to do it.
Hope this helps,
Ken
CODE
' RemoveColorsFromPart.swp
'***************************************
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swSelData As SldWorks.SelectData
Dim swFeat As SldWorks.Feature
Dim vFaceArr As Variant
Dim vFace As Variant
Dim swFace As SldWorks.face2
Dim swEnt As SldWorks.entity
Dim Feature As Object
Dim vBodyArr As Variant
Dim vBody As Variant
Dim swBody As SldWorks.body2
Dim vMatProp As Variant
Dim Face As Object
Dim bStatus, AnyFeatures As Boolean
Dim iNumFeat, iCount1, nSelCount, RemainingFeatures As Integer
Dim sFeatName As String
Dim NumFeatures As Long
Dim FeatureName As String
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
If Not swModel.GetType = swDocPART Then
bStatus = MsgBox("This program only works for Part files.", vbCritical)
End
End If
swModel.ClearSelection2 True
RemainingFeatures = swModel.GetFeatureCount()
nSelCount = swSelMgr.GetSelectedObjectCount
swModel.ClearSelection2 True
AnyFeatures = False
'Use for all Surfaces
iNumFeat = swModel.GetFeatureCount
Set Feature = swModel.FirstFeature
For iCount1 = 1 To iNumFeat
Feature.Select (True)
Set swFeat = swSelMgr.GetSelectedObject5(1)
Set swSelData = swSelMgr.CreateSelectData
FeatureName = Feature.GetTypeName()
Debug.Print FeatureName
If FeatureName = "RefSurface" Then
AnyFeatures = True
vFaceArr = swFeat.GetFaces: If IsEmpty(vFaceArr) Then Exit Sub
For Each vFace In vFaceArr
Set swFace = vFace
Set swEnt = swFace
swEnt.Select4 True, swSelData
swModel.SelectedFaceProperties 0, 0, 0, 0, 0, 0, 0, 1, ""
Next
End If
swModel.ClearSelection2 True
Set Feature = Feature.GetNextFeature()
Next iCount1
'Use for all (surfaces and solids) if one solid body is present
vBodyArr = swModel.GetBodies2(swAllBodies, False)
If Not IsEmpty(vBodyArr) Then
For Each vBody In vBodyArr
AnyFeatures = True
Set swBody = vBody
If Not vBody Is Nothing Then
Set Face = vBody.GetFirstFace
While Not Face Is Nothing
bStatus = Face.Select(True)
swModel.SelectedFaceProperties 0, 0, 0, 0, 0, 0, 0, 1, ""
swModel.ClearSelection2 True
Set Face = Face.GetNextFace
Wend
swModel.ClearSelection2 True
iNumFeat = swModel.GetFeatureCount
Set Feature = swModel.FirstFeature
For iCount1 = 1 To iNumFeat
If Feature.IsSuppressed = False Then
Feature.Select (True)
sFeatName = Feature.Name
swModel.SelectedFeatureProperties 0, 0, 0, 0, 0, 0, 0, 1, 0, sFeatName
swModel.ClearSelection2 True
Set Feature = Feature.GetNextFeature
End If
Next iCount1
End If
Next
End If
If AnyFeatures = True Then
MsgBox ("Colors successfully removed from solid bodies and surfaces." & Chr(13) & Chr(13) & "You may need to run this for each configuration")
Else
bStatus = MsgBox("Remove colors failed. This file probably doesn't contian any solid bodies or surfaces.", vbExclamation)
End If
swModel.ClearSelection2 True
End Sub
RE: Color Out of Control
Any help would be greatly appreciated.
Thanks in adavance
RE: Color Out of Control
Note: macros are stored as separate files (not within the SW documents)
Copy the text above (note were you save it to).
Insert a new macro.
Paste (overwrite anything that's there) with this text.
Exit.
Now play macro.
That should be enough to start with.
Ken
RE: Color Out of Control
Chris
Sr. Mechanical Designer, CAD
SolidWorks 05 SP1.1 / PDMWorks 05
ctopher's home site
RE: Color Out of Control
I get the error message “Variable not defined” pointing to this line
If Not swModel.GetType = swDocPART Then
How do I fix this?
Thanks
RE: Color Out of Control
I suppose I could have used several configurations, but it seems like if you are allowed to color in an assembly, it should at least work correctly!
I did find that applying color in the FeatureManager was much more reliable than doing it in the graphics window. However, there are still problems with how the assembly comes across in the drawing. Is there any way to "grey out" the lines in a drawing?
RE: Color Out of Control
Using color in assemblies does work correctly, I have used it to turn "future" parts translucent. I think what ctopher is saying is he avoids doing it to avoid confusion.
The confusion is due someone using the file later and not knowing if the color is applied at the assembly, part, body, feature, or face.
Changing colors using ctopher's method will guarantee the color is always at the part level and not the others. If you right-click in the graphics area you may get any 3 of the above and users not paying attention may not even realize which one they just selected.
RE: Color Out of Control
In the VBA editor, first STOP the macro if it's still running. Then go to Tools/References and make sure that SolidWorks Constant type library is checked.
Hopefully it should work now.
Ken
RE: Color Out of Control
That worked