Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 0 down vote accepted
def dfx_output_text
    model = Sketchup.active_model
    entities = model.entities
    if (entities.length > 0)
    	$dxf_file = "test.dxf" , "w" )
    	i = 0
    	while i < (entities.count)
    		if(entities[i].typename == "Text")

def dxf_ouput_text(text)
    points = text.point
    $dxf_file.puts( "  0\nTEXT\n1\n192\n330\n1F\n100\nAcDbEntity\n8\n""\n")
    if(points == nil)	
    $dxf_file.puts("40\n"+(1).to_s+"\n")#text height
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .