johnggold Posted August 26, 2010 Posted August 26, 2010 I write machine control software in C - directly generating stripped down simple DXF files in R12 export format. Normally only LINE and ARC functions are required as the output is a series of enclosed convex polygons consisting of straight lines, arcs. For one application, I have been requested to add a label to each polygon in its centre. I need a basic AutoCAD command that writes text to an X,Y coordinate position, and that is R12 compatible. Thanks. Quote
BlackBox Posted August 26, 2010 Posted August 26, 2010 I believe this AutoLISP command will work: (command "._text" '([color=red]xCoord[/color] [color=red]yCoord[/color]) [color=red]TextHeight[/color] [color=red]RotationAngle[/color] [color=red]TextString[/color] "" "") Just replace the red place holders with the described values you require. Quote
fuccaro Posted August 26, 2010 Posted August 26, 2010 That lisp will insert a piece of string using the current text style. Since the text style may or may not contain the text height, a problem will occur if Autolisp doesn't send the data as are expected. Johnggold, it must be an AutoCAD command? If you write the file with your C program and assuming we are talking about an ASCII dxf file, you could put in something like this: (0 . "TEXT") (1 . "Blah-blah... content goes here") (8 . "Layer name") (10 Xposition Yposition) For short text, this is the shortest DXF lisp (I think). There is no Zpozition in the last line, you asked for R12. I didn't test it, but it should work. Quote
johnggold Posted August 27, 2010 Author Posted August 27, 2010 Thanks. I will try that. zposition is not needed as its all 2D. Quote
fuccaro Posted August 28, 2010 Posted August 28, 2010 In the mean time I tested the solution I proposed. Well, the information is correct, but the topic is "AutoLisp like". With other words: it will not work in that form. Try this: 0 TEXT 10 Xpos 20 Ypos 1 text goes here Searching for the minimal code, I see that also it worked without the layer code. The text goes on the layer 0 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.