Create a "save as x_t" button

Hi all

I'm looking to create a button under the SLW assembly environment, so that I can save as parasolid *.x_t quickly.

How to do it?

Thank you for your help.

 

 

Hello, you will have to go through a macro.

 

Do you know how it works?

Hello

I tinkered with it to record in DXF, it works well! (There are people here much more knowledgeable than me in the field :))

There I modified it to make X_T.

All you have to do is put it on a button in your assembly model!

http://www.lynkoa.com/tutos/3d/ajouter-un-bouton-pour-macro-dans-solidworks

 

Good luck

 

Sub Sauvegarde_X_T()

 

   
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim Locatie As String
Dim Locatie_aangepast As String
Dim OpenDoc As Object
Dim Extensie_nieuw As String
Dim Extensie_oud As String
Dim retval As String
Dim Naam As String
Dim Naam_aangepast As String

 

Set swApp = CreateObject("SldWorks.Application")
Set swModel = swApp.ActiveDoc
Set OpenDoc = swApp.ActiveDoc()

Extensie_oud = ". SLDASM"
Extensie_nieuw = ". X_T"
Locatie = OpenDoc.GetPathName
Locatie_aangepast = Left(Locatie, Len(Locatie) - 7)
retval = Dir$(Locatie_aangepast & Extensie_oud)
Naam = Dir$(Locatie)
Naam_aangepast = Left(Naam, Len(Naam) - 7)
Titel = OpenDoc.GetTitle
Titel = Left(Titel, (Len(Titel)))


   ' If retval = Naam Then
        'nRetval = swApp.SendMsgToUser2(Naam_aangepast & " DXF created !!! ", swMbWarning, swMbOk)
   ' End If
    
    
Set Part = swApp.ActiveDoc
longstatus = Part.SaveAs3(Naam_aangepast & Extensie_nieuw, 0, 0)

End Sub

 

2 Likes

Hello

 

I made a macro to save under a new document, you can use it as inspiration to create your macro. Every line is commented out, which is handy for VBA programming beginners:

http://www.lynkoa.com/tutos/3d/macro-enregistrer-sous-avec-solidworks

To add a button:

http://www.lynkoa.com/tutos/3d/ajouter-un-bouton-pour-macro-dans-solidworks

And for parasolid, see this link:

https://forum.solidworks.com/thread/27668