Skip to content

Write text to the information bar of a dwg file #1016

Closed Answered by fly-sure
fly-sure asked this question in Q&A
Discussion options

You must be logged in to vote

I tried to write text to the dwg file using dwg_add_TEXT, but it didn't work and the dwg file didn't seem to change. Could you please help me figure out what went wrong?

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dwg.h>
#include <time.h>
#include "dwg_api.h"

static int add_text(Dwg_Data *dwg, dwg_point_3d *pt)
{
  int error = 0;
  char text[128];
  double height = dwg->header_vars.TEXTSIZE;
  time_t t = time (NULL);
  Dwg_Object_BLOCK_HEADER *hdr = dwg_get_block_header (dwg, &error);
  Dwg_Entity_TEXT *ent;

  strftime (text, sizeof (text), "Last updated: %c", localtime (&t));

  if ((ent = dwg_add_TEXT (hdr, text, pt, height)))
    {
      ent->horiz_alignment …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fly-sure
Comment options

Answer selected by rurban
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants