Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

What is with Solidworks Color? 2

Status
Not open for further replies.

CADGemini

Mechanical
May 12, 2004
481
Hello All,

I am wondering why there are so many ways to color something in solidworks. Alot of user's here color faces, then maybe a feature, then color it again in an assembly. I know that in 2006 this feature has been enhanced.

I try to tell the user's here to color the part and never in the assembly. Also within the part you can apply textures to faces, features, or bodies. The same goes for colors. I found a couple macros that will return all face colors and feature colors back to model color which helps somewhat. However these macros do not work with a Multi-bodied component.

Just curious if anyone else gets a headache when an in-experienced user is coloring things completly wrong.


Best Regards,
Jon

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

Solidworks 2005 SP3.1
 
Replies continue below

Recommended for you

I never re-color a part in an assy ... only in the part file. If I work in someone else's assy, I will remove the colors. There are macros that will do this.
I have not read/heard a reason to want to re-color a part in assy.

Chris
Sr. Mechanical Designer, CAD
SolidWorks 05 SP3.1 / PDMWorks 05
ctopher's home site (updated 06-21-05)

FAQ559-1100
FAQ559-716
 
I think this usually happens because a user's options settings don't reveal the parts' color settings to show up in the context of an assembly. Then people add colors in the assembly to get a rendering done. Now you've got a mess.

Tools > Options is probably the best place to start to make sure everything visible in the part level is also visible in the assembly--so as not to tempt someone to add confusing colors that end up being difficult to manage later.


Jeff Mowry
Reality is no respecter of good intentions.
 
I use "Model Properties" (not "Model Colors") from Lenny's website:
It will color an entire assembly, or just picked parts. You can also remove feature colors.

One of the users here colors the part at the assembly level, not the part level. The reason behind this is that it is easy to spot the original in a part-pattern within an assembly.

I prefer using different colors for configurations of a part because it makes it easy to spot the different configurations in an assembly (so I only set colors at the part level).

Flores
 
What is wrong coloring the parts in the assembly? Just because poor software sometimes forgets the colors doesn't break things...I am looking for a image to render, so I "paint" the assembly.

Should I go back to every part and subassembly and apply colors there instead?

3000 hours and counting on SW, 0 hours training
 
Good point. I think this is why SW revamped color tracking in 2006. I'll be glad to see this fix, since I do a lot of work with pre-cluttered client files.


Jeff Mowry
Reality is no respecter of good intentions.
 
I have this macro that is a combination of the RemoveColorsFromFeatures and RemoveColorsFromFaces macros. It also removes colors from all bodies in multi-body parts. One drawback is that you have to run it for each configuration.

Ken

Code:
'***************************************
' RemoveAllColorsFromPart.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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor