Skip to content

Export SVG from Fusion and import to Hamamatsu CNC

Issue:The imported design size is incorrect

alt text alt text
The imported size is incorrect (Fusion 100x100mm → Cut2D 2.822x2.822mm)
alt text alt text

Fusion -> Shaper Utilities -> SVG

100x100mm
alt text
alt text
SVG
alt text

Inkscape

Install from command line

% brew install --cask inkscape
% which inkscape
/opt/homebrew/bin/inkscape

Note

If you have already installed Inkscape.app using the installer, delete the app first.

SVG to DXF

% cd path/to/file
% inkscape input.svg --export-filename=output.DXF

Cut2D

alt text

alt text

Apple Script

on open droppedFiles
    -- ドロップされたファイルを処理する / Process dropped files
    set successCount to 0 -- 成功した変換のカウント / Count of successful conversions

    repeat with eachFile in droppedFiles
        -- ファイルのパスを取得 / Get the file path
        set filePath to POSIX path of eachFile

        -- 拡張子をチェックし、SVGファイルのみを処理 / Check file extension and process only SVG files
        if filePath ends with ".svg" then
            -- 出力ファイルのパスを決定(拡張子を .dxf に変更) / Determine output path (change extension to .dxf)
            set outputFilePath to (text 1 through -5 of filePath) & ".dxf"

            -- 出力ファイルがすでに存在するか確認 / Check if the output file already exists
            set fileExists to false
            try
                set fileExists to (do shell script "test -e " & quoted form of outputFilePath & " && echo true || echo false") is "true"
            end try

            -- 既存のファイルがある場合、上書きするか確認 / If the file exists, ask the user if they want to overwrite
            if fileExists then
                set overwriteChoice to display dialog "The file '" & outputFilePath & "' already exists. Do you want to overwrite it?" buttons {"Cancel", "Overwrite"} default button "Cancel"
                if button returned of overwriteChoice is "Cancel" then
                    -- ユーザーがキャンセルを選択した場合はこのファイルをスキップ / Skip this file if the user cancels
                    log "Skipped: " & filePath
                    exit repeat
                end if
            end if

            -- Inkscapeを使用してSVGをDXFに変換 / Convert SVG to DXF using Inkscape
            try
                do shell script "/opt/homebrew/bin/inkscape " & quoted form of filePath & " --export-filename=" & quoted form of outputFilePath
                set successCount to successCount + 1 -- 成功した場合にカウント増加 / Increment count on success
            on error errorMessage
                -- エラーが発生した場合はエラーメッセージを表示 / Show error message if conversion fails
                display dialog "An error occurred: " & errorMessage buttons {"OK"} default button "OK"
            end try

        else
            -- SVG以外のファイルがドロップされた場合の警告 / Warn if a non-SVG file is dropped
            display dialog "Only SVG files can be processed." buttons {"OK"} default button "OK"
        end if
    end repeat

    -- 成功した場合のみ完了メッセージを表示 / Show completion message only if at least one file was converted successfully
    if successCount > 0 then
        display dialog "SVG files have been converted to DXF! (" & successCount & " files)" buttons {"OK"} default button "OK"
    end if
end open