Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 351383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:38:19+00:00 2026-05-12T11:38:19+00:00

How can I write text entities to a dxf file? I found a script

  • 0

How can I write text entities to a dxf file?

I found a script that can export Sketchup drawings to dxf files, unfortunately it was ignoring layers and text. I fixed it so it outputs the proper layer, but I cannot figure out how to get it to output the text.

I have it to the point where it pops up a message when it comes across a text entity in the entities collection, but I’m not sure how to get it to write it to the file properly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T11:38:19+00:00Added an answer on May 12, 2026 at 11:38 am

    This is how I did it.

    def dxf_text_output_test
        $dxf_file = File.new("C:\testfile.dxf" , "w" ) 
        model = Sketchup.active_model
        entities = model.entities
        entities.each do |entity|
            if(entity.typename="Text")
                dxf_output_text(entity)
            end
        end
    end
    
    def dxf_ouput_text(text)
        points = text.point
        $dxf_file.puts( "  0\nTEXT\n1\n192\n330\n1F\n100\nAcDbEntity\n8\n"+text.layer.name+"\n")
        $dxf_file.puts("100\nAcDbText\n")
        if(points == nil)   
            $dxf_file.puts("10\n0.0\n")#x
            $dxf_file.puts("20\n0.0\n")#y
            $dxf_file.puts("30\n0.0\n")#z
        else
            $dxf_file.puts("10\n"+(points.x.to_f * $dxf_conv).to_s+"\n")#x
            $dxf_file.puts("20\n"+(points.y.to_f * $dxf_conv).to_s+"\n")#y
            $dxf_file.puts("30\n"+(points.z.to_f * $dxf_conv).to_s+"\n")#z
        end
        $dxf_file.puts("40\n"+(1 * $dxf_conv).to_s+"\n")#text height
        $dxf_file.puts("39\n"+text.line_weight.to_s+"\n")#thickness
        $dxf_file.puts("1\n"+text.text+"\n")#text
    end 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, that's it. How can I write to a text file using AppleScript? I've
Is there a way I can write text to a file from a certain
In Cocoa, how can I write a string to a text file without replacing
I know that with mysql you can write SQL statements into a .sql file
In Oracle, you can write: update t set xml = updateXML(xml, '/a/b/text()', 'gaga') This
How can I write a semi transparent text on an Image (Jpg,Bmp), or a
How can I get an application to write debug text to the Event Log
In SQL one can write a query that searches for a name of a
I can write: update my_table set xml = updateXML(xml, '/a/b', '1') where document_id =
In Eclispe you can do Ctrl+Shift+R and a Window popup where you can write

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.