📄 ltype.c
字号:
/****************************************************************/
/* COPYRIGHT NOTICE */
/* ---------------- */
/* All software in this listing remain the strict copyright */
/* of Ilija Kovacevic and cannot be copied or used in any way */
/* except by written permission of Ilija Kovacevic. */
/* */
/* Copyright (c) 1992 Ilija Kovacevic */
/* www.kov.com email ilija@kov.com */
/****************************************************************/
#include "dwgin.h"
PUBLIC AcadLineType *AcadLineType__create( void )
{
return( ( AcadLineType * )get_memory( sizeof( AcadLineType ) ) );
}
PUBLIC void AcadLineType__delete( AcadLineType *me )
{
free( ( char * )me );
}
PUBLIC void AcadLineType__read( AcadLineType *me )
{
INT16 unknown;
int index;
if ( debugger ) dprintf( "\nLTYPE ----------------------------------------------------\n" );
get_UINT8( &me->flags );
get_array( &me->name,sizeof( me->name ) );
if ( __drawing->acad11 ) get_INT16( &unknown );
get_array( &me->description,sizeof( me->description ) );
get_UINT8( &me->alignment );
get_UINT8( &me->number_of_dashes );
get_DOUBLE( &me->length );
for( index = 0; index < 12; ++index ) get_DOUBLE( &me->dash[ index ] );
}
PUBLIC void AcadLineType__dxfout( AcadLineType *me )
{
DOUBLE remaining_dash_length;
UINT8 i;
dxf_string( 0,"LTYPE" );
dxf_string( 2,me->name );
dxf_char( 70,me->flags );
dxf_string( 3,me->description );
if ( ( me->alignment ) EQ 'A' ) dxf_INT16( 72,65 );
dxf_char( 73,me->number_of_dashes );
dxf_DOUBLE( 40,me->length );
remaining_dash_length = me->length;
for ( i = 0; i < me->number_of_dashes; ++i )
{
dxf_DOUBLE( 49,me->dash[ i ] );
if ( me->dash[ i ] > 0 ) remaining_dash_length -= me->dash[ i ];
else remaining_dash_length += me->dash[ i ];
}
}
PUBLIC void AcadLineType__dump_to_debug_file( AcadLineType *me )
{
DOUBLE remaining_dash_length;
int i;
dprintf( "\nLINETYPE\n" );
dprintf( "\tNAME [%s]\n",me->name );
dprintf( "\tflags = %d\n",me->flags );
dprintf( "\tdescription = [%s]\n",me->description );
dprintf( "\tAlignment = %c\n",me->alignment );
dprintf( "\tNumber of dashes = %d\n",me->number_of_dashes );
dprintf( "\tLength = %lf\n",me->length );
remaining_dash_length = me->length;
if ( remaining_dash_length )
{
for ( i = 0; i < 12; ++i )
{
if ( remaining_dash_length <= 0.00001 ) break;
dprintf( "Dash %lf\n",me->dash[ i ] );
if ( me->dash[ i ] > 0 ) remaining_dash_length -= me->dash[ i ];
else remaining_dash_length += me->dash[ i ];
}
}
}
PUBLIC void AcadLineType__write( AcadLineType *me )
{
int index;
put_UINT8( me->flags );
put_array( me->name,sizeof( me->name ) );
put_array( me->description,sizeof( me->description ) );
put_UINT8( me->alignment );
put_UINT8( me->number_of_dashes );
put_DOUBLE( me->length );
for( index = 0; index < 12; ++index ) put_DOUBLE( me->dash[ index ] );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -