Reply
Solved! Go to solution

Change colors of table lines and hatch lines

[ Edited ]

Hello People,

 

I have a button in my macro ( VBA ) Which changes the colors of old drawings to new colors. But I can't get it done with the table lines and hatch lines. By hand the following things need to be done

 

In a drawing -> Styles -> Table -> Normal_1 -> Modify -> Lines tab -> Colors to black

 

Or 

 

In a drawing -> Styles -> Hatch -> Normal -> Modify -> Properties -> Pattern Color to black

 

I've tried the following

Spoiler

 

  Dim SEtablestyles As SolidEdgeFrameworkSupport.TableStyles
            SEtablestyles = SEDraftDocument.TableStyles
            Dim SEtablestyle As SolidEdgeFrameworkSupport.TableStyle
            Dim SELinecolor = SEtablestyle.LineColor()

            For Each SETablestyle As SolidEdgeFrameworkSupport.TableStyle In SEtablestyles
                linecolor = SETablestyle.LineColor '????????????'
            Next 

What is going wrong with the linecolor?

 

Solid edge Spy says this: 

The images are in the alst spoiler

 

Spoiler

Int32 LineColor(SolidEdgeFrameworkSupport.TableStyleLineTypeConstants#SolidEdgeFrameworkSupport.TableStyleLineTypeConstants lineType) { get; set; }
Member of SolidEdgeFrameworkSupport.TableStyle

Summary:
Line color.

ID:
5 (0x00000005)





Spoiler

 

 

Kindly Regards,

 

Justin

2 REPLIES
Solution
Solution
Accepted by topic author Scani
‎03-04-2016 12:31 PM

Re: Change colors of table lines and hatch lines

Hi Justin,

for the Table the LineColor is an indexed Property, so try this:

            Dim SEtablestyles As SolidEdgeFrameworkSupport.TableStyles
            Dim SEtablestyle As SolidEdgeFrameworkSupport.TableStyle

            SEtablestyles = SEDraftDocument.TableStyles
            For Each SEtablestyle In SEtablestyles
                Debug.Print(SEtablestyle.Name)

                SEtablestyle.LineColor(TableStyleLineTypeConstants.seBorder) = &HFFFF
                SEtablestyle.LineColor(TableStyleLineTypeConstants.seTitleSeparator) = &HFF00FF
                SEtablestyle.LineColor(TableStyleLineTypeConstants.seTitleHeaderSeparator) = &HFF0000
                SEtablestyle.LineColor(TableStyleLineTypeConstants.seHeaderDataSeparator) = &HFF0000
                SEtablestyle.LineColor(TableStyleLineTypeConstants.seHeaderSeparator) = &HFF00FF
                SEtablestyle.LineColor(TableStyleLineTypeConstants.seHorizontalGridLine) = &HFF0000
                SEtablestyle.LineColor(TableStyleLineTypeConstants.seVerticalGridLine) = &HFF0000

            Next

you have to update the window to see the change:

 DirectCast(objApp.ActiveWindow, SolidEdgeDraft.SheetWindow).Update()

The Hatch Style has Color Propety for the lines and FillColor Property:

Dim SEfilltyles As SolidEdgeFramework.FillStyles
 Dim SEfillstyle As SolidEdgeFramework.FillStyle
 
 SEfilltyles = SEDraftDocument.FillStyles
 SEfillstyle = SEfilltyles.Item("Normal")
 
 SEfillstyle.Color = &HFF0000 ' blue

 More complicates Hatch styles have addional Propertie in the HathPatternStyle object.

 

regards Jürgen

regards

JB
VS2015, SE ST10

Re: Change colors of table lines and hatch lines

Thanks! This worked perfect.