Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Color Out of Control

Status
Not open for further replies.

JCnot4me

Industrial
Sep 10, 2003
3
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
 
Replies continue below

Recommended for you

Yes.

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
Reality is no respecter of good intentions.
 
You have to be very careful on what you color and how you color it. What i mean is that there is a heirarchy of color on the part, ie body, face, feature...etc. Changing color at one level may override color on another level. ie Trying to delete color at a body level when it was applied in a feature level will prove ineffective.
 
There are macros on the web that will remove all face colors and all feature colors of a part. I used to use these quite often when working with newbie SW users that colored parts incorrectly.

Best Regards,
Jon

Challenges are what makes life interesting; overcoming them is what makes life meaningful.

Solidworks 2005 SP1.1
 
I have hade this problem 1 workaround I found was to apply a material to the part (make shore use material colour is selected) then remove the material
This seams to strip the added colour
 
I always RMB the face and use Face|Appearance|Color{/i] I do the same for a body, etc... I never use the icon. The best method for you would to do it remove the icon and do it the same ever time and not mix it up.

Regards,

Scott Baugh, CSWP [pc2]
3DVision Technologies

faq731-376
faq559-716 - SW Fora Users
 
I noticed another option that might make life easier:

--------------------

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.
 
JCnot4me,

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
 
I am having this exact same problem and it sounds like the RemoveColorsFromPart macro will solve it. Unfortunately I know nothing about macros. How do I use it inside SolidWorks? Do I need to copy it into SolidWorks? I have searched the forum and have found many macros that would sure make my life easier but am not able to find anything on how to use them. Copy and Paste? Save them somewhere? I know to run them from the Macro toolbar in SolidWorks but thats about it. Can someone point me in the right direction.

Any help would be greatly appreciated.
Thanks in adavance
 
OLID,
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
 
Just my .02, I never play with colors in assemblies. I change colors at part level (tools/options/doc props). THis way there is never confusion with other users.

Chris
Sr. Mechanical Designer, CAD
SolidWorks 05 SP1.1 / PDMWorks 05
ctopher's home site
 
I copied the macro but it won’t run
I get the error message “Variable not defined” pointing to this line

If Not swModel.GetType = swDocPART Then

How do I fix this?

Thanks
 
I just ran into an instance where I just about needed to use color in an assembly. We were doing a retrofit of an installation, and I wanted to color the parts that would be re-used, as opposed to the new components that we were supplying for the retrofit. Some of the new parts were the same as those being re-used, so there might be 3 instances of a part in the assembly, while only one was new.

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?
 
sbmathias,
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.
 
manxJim,

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor