Create a macro to export X_T to Solidworks 2010?

Hello

I would like to be able to export a part or assembly in X_T by clicking only a button on Solidworks 2010?

I've already found a button like this to do an export in .pdf and .dxf at the same time for my plans that works very well.

But I can't find it to export to X_T?

Thanks in advance

Just change the macro, do you know VBA programming?

See this link:

http://forum.solidagora.com/macro-api-solidworks-enregistrer-pdf-dxf-x-t101.html

No, I don't know the VBA program at all.

The link you sent me is to save the  elements of a file.

I would like a button that would make it look like I did "File/save as/" and save in Parasolid x_t

See this link 

Parasolid Macro Export

http://www.3dcontentcentral.fr/macros/macro.aspx?id=557249

https://www.dropbox.com/s/l5vscy9dkpswb1i/PARASOLID.bmp?dl=0

@+;-))

Hello

To start a macro it is often interesting to use the recorder. This will allow you to know the useful functions.

Then it is possible to deepen by looking for the targeted elements in the help: http://www.solidworks.fr/sw/support/1835_FRA_HTML.htm

Because what's interesting is above all to understand what you're coding and not just copying a code found here or there. But of course it requires a little patience and time.

Kind regards.

3 Likes

gt22 I've tried this macro before but it doesn't work.

This is a 32/64 bit version issue

The problem of iff or if

Post the macro to check if it's working properly or not

@+;-))

I just redownloaded it to try it and it puts me:

1 Like

Is your room open?

yes, actually I made a piece and then I saved it somewhere and then I press the button or I associated the macro but it shows that.

Maybe that's not how we should use it. But I have another one that works like this to save in .pdf and .dxf and that works well

It is well written (we can't see very well):

If Part.GetType = swDocDRAWING Then

Are you running the macro from a part in SolidWorks?

1 Like

I'm attaching the image


sans_titre.jpg

yes I started the macro from a coin

In fact, I don't know if that's how to use it, nothing indicates how to do it?

I found this on another post, I did it, it works exactly as I want!!

I put the file "save_x_t.swp" as an attachment for those who want it.

 

 

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


save_x_t.swp
2 Likes

I also put you the x_t.bmp icon I made.


x_t.bmp

I'm putting back the latest version of the corrected macro to save in X_T with the X_T logo that goes with :)

 

Have a good day everyone!!


save_x_t.zip