Macro removal of MEP axis lines

Hello

I'm looking to make a macro to remove the axis lines from all the unfolded views in a MEP, from all the tabs

Sheet metal workers find that it is more readable without axis lines

I found a beginning with these 2 elements that are to be deleted

swSelCENTERMARKSYMS = 100  '  "CENTERMARKSYMS"
swSelCENTERLINES = 103     '  "CENTERLINE"

 

and

https://www.lynkoa.com//forum/solidworks/macro-selectionner-toute-les-ligne-existante-sur-une-vue

but I don't know how to put it all back in the right order

 

if anyone has an idea

Thank you

HELP

if someone knows how to program at least a piece of code

Or in the absence of a fully automated macro, I can also select a MEP view and the macro removes the center lines from the holes

An example of a drawing?

What is the burt to export a dxf without an axis line?

Not possible by changing the background plan or the standard of dressing of the MEP? If so, you can maybe do it without much programming with Integration (Visiativ tool (mycadtools) to which you have access as a Mycadservice subscriber. And for this the hotline can even help you.

 

Otherwise if you have to program you will have to for your macro:

A loop that activates each sheet 1 by 1

that on each sheet you get the 1st active view, that you check if the configuration name of the referenced part is indeed flat-pattern.

If so, you make the change.

Basically not easy if you have no notion of programming and not a few things that someone will see you realize in a few seconds.

Unless you have a code that is close enough.

 

1 Like

It is a question of removing the centerlines of the holes for unfolded views only or of the other types of holes for which Solidworks displays the centerlines by default, I am not talking about the bend centerlines, I want to keep the centerlines of the holes automatic for the other types of views

These lines must be removed before starting manufacturing on a laser cutting machine or other manufacturing

For the loop on the sheets:

https://help.solidworks.com/2021/English/api/sldworksapi/Get_Loaded_Sheets_Example_VB.htm

 

Hello

Try the following:

Option Explicit

Sub main()

    Dim swApp As SldWorks.SldWorks
    Dim swModel As SldWorks.ModelDoc2
    Dim swDrawing As SldWorks.DrawingDoc
    Dim vSheetName As Variant
    Dim swView As SldWorks.View
    Dim swCtrMark As SldWorks.CenterMark
    Dim swCtrLine As SldWorks.Centerline
    Dim swAnn As SldWorks.Annotation
    Dim swSelMgr As SldWorks.SelectionMgr
    Dim swSelData As SldWorks.SelectData
    Dim status As Boolean
    Dim bRet As Boolean
    Dim i As Long
    Dim SearchString As String
    Dim SearchChar As String
    Dim MyPos As Integer

    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    Set swSelMgr = swModel.SelectionManager
    Set swSelData = swSelMgr.CreateSelectData
    Set swDrawing = swModel
    
    SearchChar = "SM-FLAT-PATTERN"
    
    vSheetName = swDrawing.GetSheetNames
    
    For i = 0 To UBound(vSheetName)
        bRet = swDrawing.ActivateSheet(vSheetName(i))
        
        Set swView = swDrawing.GetFirstView
        swModel.ClearSelection2 True
        Do While Not swView Is Nothing
            SearchString = swView.ReferencedConfiguration
            MyPos = InStr(1, SearchString, SearchChar)
            If MyPos <> 0 Then
                Set swCtrMark = swView.GetFirstCenterMark
                Do While Not swCtrMark Is Nothing
                    Set swAnn = swCtrMark.GetAnnotation
                    status = swAnn.Select3(True, swSelData)
                    Set swCtrMark = swCtrMark.GetNext
                Loop
            End If
            Set swView = swView.GetNextView
        Loop
        swModel.EditDelete
        
        Set swView = swDrawing.GetFirstView
        swModel.ClearSelection2 True
        Do While Not swView Is Nothing
            SearchString = swView.ReferencedConfiguration
            MyPos = InStr(1, SearchString, SearchChar)
            If MyPos <> 0 Then
                Set swCtrLine = swView.GetFirstCenterLine
                Do While Not swCtrLine Is Nothing
                    Set swAnn = swCtrLine.GetAnnotation
                    status = swAnn.Select3(True, swSelData)
                    Set swCtrLine = swCtrLine.GetNext
                Loop
            End If
            Set swView = swView.GetNextView
        Loop
        swModel.EditDelete
        
    Next i
    
End Sub

Kind regards

1 Like

A big thank you to d.roger who takes up the challenge once again, given the number of times one of my questions has been answered thanks to you on this forum, I take my hat off to you for your well written and concise macros

1 Like