Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
zecruel authored Nov 6, 2020
1 parent a9ec04b commit 4771691
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 104 deletions.
23 changes: 17 additions & 6 deletions src/dxf_create.c
Original file line number Diff line number Diff line change
Expand Up @@ -1337,6 +1337,7 @@ int dxf_new_ltype (dxf_drawing *drawing, dxf_ltype *line_type){

/* create a new LTYPE */
dxf_node * ltyp = dxf_obj_new ("LTYPE", drawing->pool);
dxf_node *sty_handle;

if (ltyp) {
ok = 1;
Expand All @@ -1358,21 +1359,29 @@ int dxf_new_ltype (dxf_drawing *drawing, dxf_ltype *line_type){
if (line_type->dashes[i].type == LTYP_SIMPLE)
ok &= dxf_attr_append(ltyp, 74, (void *) &flags, drawing->pool);
else {
if (line_type->dashes[i].sty_i >= 0){
sty_handle = dxf_find_attr2(drawing->text_styles[line_type->dashes[i].sty_i].obj, 5);
if (!sty_handle){
continue;
}
}
else {
continue;
}

if (line_type->dashes[i].abs_rot) flags |= 1;
if (line_type->dashes[i].type == LTYP_STRING) flags |= 2;
if (line_type->dashes[i].type == LTYP_SHAPE) flags |= 4;
ok &= dxf_attr_append(ltyp, 74, (void *) &flags, drawing->pool);

if (line_type->dashes[i].type == LTYP_SHAPE){
int shp_num = 130; /* TODO */
ok &= dxf_attr_append(ltyp, 75, (void *) &flags, drawing->pool);
char sty[DXF_MAX_CHARS] = "24"; /* TODO */
ok &= dxf_attr_append(ltyp, 340, (void *) sty, drawing->pool);
ok &= dxf_attr_append(ltyp, 75, (void *) &line_type->dashes[i].num, drawing->pool);
}
if (line_type->dashes[i].type == LTYP_STRING){
char sty[DXF_MAX_CHARS] = "13"; /* TODO */
ok &= dxf_attr_append(ltyp, 340, (void *) sty, drawing->pool);
ok &= dxf_attr_append(ltyp, 75, (void *) (int[]){0}, drawing->pool);
}
ok &= dxf_attr_append(ltyp, 340, (void *) sty_handle->value.s_data, drawing->pool);
ok &= dxf_attr_append(ltyp, 46, (void *) &line_type->dashes[i].scale, drawing->pool);
ok &= dxf_attr_append(ltyp, 50, (void *) &line_type->dashes[i].rot, drawing->pool);
ok &= dxf_attr_append(ltyp, 44, (void *) &line_type->dashes[i].ofs_x, drawing->pool);
ok &= dxf_attr_append(ltyp, 45, (void *) &line_type->dashes[i].ofs_y, drawing->pool);
Expand All @@ -1382,6 +1391,8 @@ int dxf_new_ltype (dxf_drawing *drawing, dxf_ltype *line_type){
}
}

if (!ok) return 0;

/* get current handle and increment the handle seed*/
ok &= ent_handle(drawing, ltyp);

Expand Down
2 changes: 1 addition & 1 deletion src/dxf_seed.h
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ const char *dxf_seed_2007 =
"100\n"
"AcDbTextStyleTableRecord\n"
"2\n"
"Cmplx_Line_Type\n"
"\n"
"70\n"
"1\n"
"40\n"
Expand Down
Loading

0 comments on commit 4771691

Please sign in to comment.