Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Hi Jason,

 

VBA macro has been updated to achieve requirement.

 

 

Sub main()

    Dim oDrawDoc As DrawingDocument
    Set oDrawDoc = ThisApplication.ActiveDocument

    Dim oSheet As Sheet
    
    For Each oSheet In oDrawDoc.Sheets
        Dim oView As DrawingView
        For Each oView In oSheet.DrawingViews
            Call oSheet.DrawingDimensions.GeneralDimensions.Retrieve(oView)
            Dim oCurve As DrawingCurve
            For Each oCurve In oView.DrawingCurves
                If oCurve.CurveType = CurveTypeEnum.kCircleCurve Then
                    Dim seg As DrawingCurveSegment
                    For Each seg In oCurve.Segments
                        If seg.Geometry.Radius <= 1.125 / 2 Then
                            Dim oIntent As GeometryIntent
                            Set oIntent = oSheet.CreateGeometryIntent(oCurve)

                            Call oSheet.Centermarks.Add(oIntent)

                            seg.Visible = False
                        End If
                    Next
                End If
            Next
        Next

        Dim oDataIO As DataIO
        Set oDataIO = oSheet.DataIO

        Call oDataIO.WriteDataToFile("DWF", "C:\Temp\dwfTest1.dwf")

    Next
    Call ExportDXF
End Sub

Sub ExportDXF()

' Get the DXF translator Add-In.
    Dim DXFAddIn As TranslatorAddIn
    Set DXFAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}")

    'Set a reference to the active document (the document to be published).
    Dim oDocument As Document
    Set oDocument = ThisApplication.ActiveDocument

    Dim oContext As TranslationContext
    Set oContext = ThisApplication.TransientObjects.CreateTranslationContext
    oContext.Type = kFileBrowseIOMechanism

    ' Create a NameValueMap object
    Dim oOptions As NameValueMap
    Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap

    ' Create a DataMedium object
    Dim oDataMedium As DataMedium
    Set oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

    ' Check whether the translator has 'SaveCopyAs' options
    If DXFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then

        Dim strIniFile As String
        strIniFile = ".ini path\exportdxf.ini"

        ' Create the name-value that specifies the ini file to use.
        oOptions.Value("Export_Acad_IniFile") = strIniFile
    End If

    'Set the destination file name
    oDataMedium.FileName = "c:\temp\tempdxftest.dxf"
    
    'Publish document.
    Call DXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)

End Sub

 

In the above code, there are 3 important paths (highlighted in red color) that need to be updated as per the user requirement.

 

  1. Path of .dwf - This can be changed to required path (Network path)
  2. Path of .ini - exportdxf.ini is zipped and attached with this post. This is very important file and used to mention .dxf export format. Currently, it is mentioned as "AUTOCAD VERSION=AutoCAD 2004". Need to download, unzip and locate at desire location. The desire location should be mentioned in the above code.
  3. Path of .dxf - This can be changed to required path (Network path)

 

Please feel free to contact if there is any doubt.

 

If solve your problem, click on "Accept as solution" / give a "Kudo".

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network