API, DXF option

Discussion in 'SolidWorks' started by Thomas W.Wilson, Nov 26, 2003.

  1. I would like getting the DXF option before "Save As" DXF. But, for
    each options I get the result of the DXF version.
    My Macro is:

    Dim swApp As Object
    Dim DxfVersion As Integer
    Dim DxfOutputFonts As Integer
    Dim DxfMappingFileIndex As Integer
    Dim AutoSaveInterval As Integer
    Sub main()
    Set swApp = Application.SldWorks

    ' Get the version of DXF for exporting

    DxfVersion = swApp.GetUserPreferenceIntegerValue(swDxfVersion)
    Version = Str(DxfVersion)

    ' Get whether TrueType fonts are exported (1) or only standard (0)

    DxfOutputFonts = swApp.GetUserPreferenceIntegerValue(swDxfOutputFonts)
    Fonts = Str(DxfOutputFonts)

    ' Get the map file index the file used for custom DXF mapping

    DxfMappingFileIndex =
    swApp.GetUserPreferenceIntegerValue(swDxfMappingFileIndex)
    Index = Str(DxfMappingFileIndex)

    ' Get the number of operations between auto-saves

    AutoSaveInterval = swApp.GetUserPreferenceIntegerValue(swAutoSaveInterval)
    Interval = Str(AutoSaveInterval)

    Text = Version + Chr(10) + Fonts + Chr(10) + Index + Chr(10) +
    Interval

    Box = MsgBox(Text, vbOKOnly, DXF)

    End Sub


    Thomas W. Wilson
     
    Thomas W.Wilson, Nov 26, 2003
    #1
  2. Thomas,

    I think your macro is not picking up the definitions for the constants
    swDxfVersion, swDxfOutputFonts, swDxfMappingFileIndex, swAutoSaveInterval.

    If you are running SW2004, in the Reference dialog box on the Tools menu in
    the VB editor search for check box labelled Solidworks Constant type library
    and make sure it is checked. That will give your macro access to the
    definitions from swconst.tlb.

    If you don't have SW2004 installed, there will be no swconst.tlb, so the
    above approach won't work. The constants are defined in a file called
    swconst.bas instead. You can import this file into VBA using import on the
    file menu - it is in C:\Program Files\SolidWorks\samples\appcom or similar.

    Alternatively, you can just paste the minimal definitions into your macro:

    Public Enum swUserPreferenceIntegerValue_e
    swDxfVersion = 0
    swDxfOutputFonts = 1
    swDxfMappingFileIndex = 2
    swAutoSaveInterval = 3
    End Enum
     
    Paul Delhanty, Nov 26, 2003
    #2
  3. Thanks Paul,


    Thomas W. Wilson
     
    Thomas W.Wilson, Nov 27, 2003
    #3
  4. Thomas W.Wilson

    rocheey Guest

    You probably already know this, but to have the fonts come thru in a
    DXF, you will need to export r13 or newer version DXF.
     
    rocheey, Dec 1, 2003
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.