Export dxf

Hello group, 

Could someone advise me on the feasibility of a macro. I work with the mechanic welders and I would like to select a face, then, so that the macro can do the following steps:

1-Keep the selected surface

2- Find the name of my directory in my list of Mechanic Welders according to the selected surface. (I guess I have to search by the body and name of the surface but can I easily find the body with the surface) 

3- Export the surface with the name of my directory in DXF 

I think it's possible but I'm not very good at programming, before I start, I'd like to have your comments.

Thank you

Hello.

For point 1. Below is a code that I use to retrieve a component but that goes through this step.

Public swApp As Object
Public swmodel As SldWorks.ModelDoc2
Public asm As SldWorks.AssemblyDoc
Public composants() As Object
Public Selectmanager As SelectionMgr
Public bool1 As Boolean
Public y As Double
Public face As Face2
Public faceEntity As Entity
Public oss As String

Set swApp = Application.SldWorks
Set frame = swApp.frame
Set swmodel = swApp.ActiveDoc


   swmodel.ClearSelection2 True
    Set Selectmanager = swmodel.SelectionManager 'recuperer selection
    swmodel.ClearSelection2 True ' effacer selection
    MsgBox ("Sélectionner la piece ")
      
            ' boucle pour attente selection
    
                bool1 = False
                Do Until bool1 = True
                    If Selectmanager.GetSelectedObjectType3(1, -1) = 2 Then
                    bool1 = True
                    End If
                    For y = 1 To 50000
                    DoEvents
                    Next y
                Loop
    
            'recup le nom de la piece selectionnée
            Set face = Selectmanager.GetSelectedObject6(1, -1)
            Set faceEntity = face

 

Then for point 2 I have to have a piece of code if necessary I have to look for it.

 

Let's see if point 3 is feasible never had this case.

Hoping that this can help you.

 

A. Mendes

 

1 Like