AnsweredAssumed Answered

How to compare a custom property?

Question asked by Gabriel Bueno on Jan 21, 2015
Latest reply on Jan 30, 2015 by Adam Hoffman

I need to compare the custom property Material to a layer in the drawing. I just need a sample of a code like this to finish my API. All this will be part of a bigger Macro that I'm working.

 

I saw this code at CadSharp and I believe that this will help me with what I really want. the Red line is wrong but maybe will give an idea about my question

 

 

@

Sub main()

    Set swApp = Application.SldWorks

    Set swModel = swApp.ActiveDoc

    Set swDraw = swModel

    vSheetViews = swDraw.GetViews

    For i = 0 To UBound(vSheetViews)

        vViews = vSheetViews(i)

        For j = 0 To UBound(vViews)

            Set swView = vViews(j)

            Set swDrawComp = swView.RootDrawingComponent

            If Not swDrawComp Is Nothing Then

                vDrawComps = swDrawComp.GetChildren

                If IsEmpty(vDrawComps) = False Then

                    For k = 0 To UBound(vDrawComps)

                        Set swDrawComp = vDrawComps(k)

                     

                        If InStr(1, swCustPropMgr "Material", "MDF") <> 0 Then Part.ChangeComponentLayer "MDF" = true

 

 

                    Next k

                End If

            End If

        Next j

    Next i

    swModel.EditRebuild3

End Sub

Outcomes