Would it be possible to have the surface to be painted of a part or assembly directly on solidworks?

You can already see the surface of the room but it takes all the surfaces of each room, and I would only like the surfaces that can be painted.

To calculate the amount of paint needed on a part or assembly.

Hello

To achieve your goal, you need to proceed in two steps.

- You have to paint each surface individually (look at the mini-tutorial I proposed https://www.lynkoa.com/forum/conception-3d/rendu-couleur-des-assemblage-sur-solidworks?page=0#answer-1083308)

- You need to select the surface and activate the measure function, you will have the surface automatically.

These are the two ultra-basic methods, but my colleagues will hopefully give you other, more automatable solutions.

Kind regards

1 Like

Okay, thank you for the answer. 

But yes, what I'm looking for is something automatic because it would be useful for a program that would take this data directly without having to enter anything.

Hello

It depends on what is called automatic because it will be necessary to designate at a given time the surface to be painted. It depends on how the volume is made, for example, if you make a cube and you want to paint only one side, well you can't use extrusion as it is, because you have to go through appearances because the dsplay nanager is of no use in your case.

This surely means being able to either designate the surface to be painted by hand (or by a code). Then with a macro that will launch the surface measurement and constitute a list with "N" characteristics  put in a file that can be used in Excel.

Have you looked at the tutorial to realize the complexity of what you want to compare to ==> select the face ==> click on measure ==> put the information in a ??? linked to the room.

Kind regards

 

2 Likes

Hello;

Have you thought about Sensors?

http://help.solidworks.com/2020/French/SolidWorks/sldworks/c_Sensors_OH.htm

To be displayed directly in a Nomenclature?

2 Likes

Hello

As you can see as an example in my attachment, the part is welded, then painted and what I would like to have is only the surface of what is in red and not what is inside. In other words, the surfaces are visible to the naked eye, the outer surfaces. You see? 

So the sensors are of no use to me except if they have a function that I don't know.

Yes, I am aware of the complexity of what I am asking for, but the development of a program would not be possible? 

 


capture.png

Hello

Given the center of gravity symbol on the last capture, it is an assembly?
In this case, it is possible to create a part in the context, then with the " offset surface" function to copy all the faces of the same color (see offset them by 0.05mm to avoid display bugs), then it is enough to retrieve the surface variable of this part in the nomenclature.
The operation can be repeated for each color.

PS: the solution of @ZozoMP combined with @Maclane 's are the 1st that came to mind as well.

2 Likes

Yes, this is an assembly and there are a lot of components under the closing sheets, so the surface is not precise enough and would make us order way too much paint. 

Is it possible to copy all the faces of the same color at once? Without having to select them all?

Hello @l.manceau 

"Is it possible to copy all the faces of the same color at once? Without having to select them all?"  you don't have to try

Hello

It seems possible to me by macro, here is one that should be able to serve as a starting point, it is probably to be adapted to your needs:

Option Explicit

Sub main()

    Dim swApp As SldWorks.SldWorks
    Dim swModel As SldWorks.ModelDoc2
    Dim Assembly As SldWorks.ModelDoc2
    Dim myAssy As SldWorks.AssemblyDoc
    Dim myComps As Variant
    Dim myCmp As Component2
    Dim swSelMgr As SldWorks.SelectionMgr
    Dim swSelData As SldWorks.SelectData
    Dim swPart As SldWorks.PartDoc
    Dim swBody As SldWorks.Body2
    Dim swFace As SldWorks.Face
    Dim swEnt As SldWorks.Entity
    Dim bRet As Boolean
    Dim vBodies As Variant
    Dim vMatProp As Variant
    Dim mySurface As Double
    Dim myColor As String
    Dim mySearchColor As String
    Dim i As Long
    Dim ninfo As Long

    Set swApp = CreateObject("SldWorks.Application")
    
    Set Assembly = swApp.ActiveDoc
    Set myAssy = Assembly
    
    mySurface = 0
    myColor = ""
    
    myComps = myAssy.GetComponents(False)
    For i = 0 To UBound(myComps)
        Set myCmp = myComps(i)
        bRet = myCmp.Select2(False, 0)
        bRet = myAssy.EditPart2(True, True, ninfo)
        
        Set swModel = myAssy.GetEditTarget
        
        Set swPart = swModel
    
        swModel.ClearSelection2 True
    
        Set swSelMgr = swModel.SelectionManager
        Set swSelData = swSelMgr.CreateSelectData
        vBodies = swPart.GetBodies2(swAllBodies, True)
        Set swBody = vBodies(0)
        Set swFace = swBody.GetFirstFace

        'C'est ici que l'on définit la couleur à chercher
        mySearchColor = "[255, 0, 0]" 'rouge
        'mySearchColor = "[0, 255, 0]" 'vert
        'mySearchColor = "[0, 255, 255]" 'cyan
    
        Do While Not swFace Is Nothing
            vMatProp = swFace.MaterialPropertyValues
            If Not IsEmpty(vMatProp) Then
                myColor = "[" & vMatProp(0) * 255# & ", " & vMatProp(1) * 255# & ", " & vMatProp(2) * 255# & "]"
                If myColor = mySearchColor Then
                    Set swEnt = swFace
                    bRet = swEnt.Select4(True, swSelData)
    
                    mySurface = mySurface + swFace.GetArea
                End If
            End If
    
            Set swFace = swFace.GetNextFace
        Loop
        
        myAssy.EditAssembly
    Next i
    
    Debug.Print ""
    Debug.Print "Surface totale de couleur " & mySearchColor & " : " & mySurface
    
End Sub

Kind regards

1 Like