📄 atlast.dxt
字号:
10 group
zmax 2!
ymax 2!
xmax 2!
;
\ Return the base-10 equivalent of a hexadecimal string.
\ e.g. String "10" is converted to number 16.
\ Stack on entering: Stack on leaving:
: strhexint ( ... addr1 ) ( ... n )
"0x" edbuf strcpy ( ... addr1 )
edbuf ( ... addr1 edbuf )
strcat ( ... )
edbuf strint swap drop ( ... n )
;
: dxf:header:$handseed
handleson @ if
rewind @ if
\ Second pass.
5 group strhexint ( ... oldnexthandle )
\ Handles are in hex.
nexthandle @ "%lX" edbuf strform
edbuf 5 setgroup
\ Now load the 'nexthandle' with the original 'oldnexthandle'.
nexthandle ! ( ... )
else
\ First pass.
5 group strhexint nexthandle !
then
else
." "Warning. Handle seed value present, but handles not enabled."
then
;
: dxf:header:$handling
70 group
0= if
false handleson !
else
true handleson !
then
;
remove dxf:classes
remove dxf:objects
( Entities to delete )
\ Since apps can now create their own entities, we don't know what
\ entities should be deleted - only which ones to keep ...
: removeUnknownEnts
0 group "SECTION" strcmp 0= if exit then
0 group "ENDSEC" strcmp 0= if exit then
0 group "3DFACE" strcmp 0= if exit then
0 group "ATTDEF" strcmp 0= if exit then
0 group "ATTRIB" strcmp 0= if exit then
0 group "ARC" strcmp 0= if exit then
0 group "CIRCLE" strcmp 0= if exit then
0 group "DIMENSION" strcmp 0= if exit then
0 group "INSERT" strcmp 0= if exit then
0 group "LINE" strcmp 0= if exit then
0 group "POINT" strcmp 0= if exit then
0 group "POLYLINE" strcmp 0= if exit then
0 group "SEQEND" strcmp 0= if exit then
0 group "SHAPE" strcmp 0= if exit then
0 group "SOLID" strcmp 0= if exit then
0 group "TEXT" strcmp 0= if exit then
0 group "TRACE" strcmp 0= if exit then
0 group "VERTEX" strcmp 0= if exit then
0 group "VIEWPORT" strcmp 0= if exit then
0 group "BLOCK" strcmp 0= if exit then
0 group "ENDBLK" strcmp 0= if exit then
1 delitem !
1 specialdone !
;
( Block definition transformations )
( Dimension entity transformations )
32 not maskfield dxf:*:DIMENSION:70 \ remove 32 bit flag of group 70
( Delete specific group data )
ditchgroup dxf:*:*:300-369 \ Drop all arbitrary strings, chunks and handles
ditchgroup dxf:*:*:100 \ Drop all AcDb... groups (eg. AcDbSymbolTable, AcDbLinetypeTableRecord, etc)
ditchgroup dxf:*:*:60 \ Ignor Invisibility flag
ditchgroup dxf:*:*:102 \ drop arbitrary strings in 102 groups
ditchgroup dxf:*:VPORT:5
ditchgroup dxf:*:LTYPE:5
ditchgroup dxf:*:LTYPE:74-75
ditchgroup dxf:*:LTYPE:44-46
ditchgroup dxf:*:LTYPE:50
ditchgroup dxf:*:LAYER:5
ditchgroup dxf:*:STYLE:5
ditchgroup dxf:*:VIEW:5
ditchgroup dxf:*:UCS:5
ditchgroup dxf:*:APPID:5
ditchgroup dxf:*:APPID:71
ditchgroup dxf:*:MTEXT:1000-1100
ditchgroup dxf:*:BLOCK:5
: printobject
." "Object printout:" cr
stdout printitem cr
;
: dxf:tables:block_record
5 group? if
1 delitem !
then
;
: removeXdata
1101 1000 do
i dup loopCount ! ( ... i )
groupcount2 dup if ( ... count )
0 do ( ... )
loopCount @ delgroup
loop
else ( ... count )
drop ( ... )
then
loop
;
\ Remove all XREF data from the TABLES section.
: dxf:tables:vport
removeXdata
;
: dxf:tables:ltype
removeXdata
9 delgroup
74 delgroup
2 group? if
2 group "BYBLOCK" strcmp 0= if
1 delitem !
then
2 group "BYLAYER" strcmp 0= if
1 delitem !
then
then
;
\ replace all .ttf and .pfa text styles with txt
: dxf:tables:style
removeXdata
3 group? if
3 group ".ttf" strstr 0= if
"txt" 3 setgroup
then
3 group ".pfa" strstr 0= if
"txt" 3 setgroup
then
3 group strlen 0= if
"txt" 3 setgroup
then
then
;
: dxf:tables:layer
removeXdata
;
: dxf:tables:view
removeXdata
;
: dxf:tables:ucs
removeXdata
;
: dxf:tables:appid
removeXdata
;
: dxf:tables:dimstyle
groupcount 1 = if
0 group? if
1 delitem !
then
then
groupcount 4 = if
5 delgroup
then
105 delgroup
100 delgroup
270 delgroup
271 delgroup
272 delgroup
273 delgroup
274 delgroup
275 delgroup
280 delgroup
281 delgroup
282 delgroup
283 delgroup
284 delgroup
285 delgroup
286 delgroup
287 delgroup
288 delgroup
removeXdata
;
: starmodel ( ... n )
dup dup ( ... n n n )
group? if ( ... n n )
group ( ... n addr1 )
"*MODEL_SPACE" ( ... n addr1 addr2 )
strcmp ( ... n flag )
0= if ( ... n )
"$MODEL_SPACE" ( ... n addr3 )
swap ( ... addr3 n )
setgroup ( ... )
else ( ... n )
drop ( ... )
then
else ( ... n n )
drop drop ( ... )
then
;
\ Remove any existing "$MODEL_SPACE" blocks. These can occur in the following
\ scenario: 1. DXFIX an R13 drawing.
\ 2. Read in the R12 dxf file.
\ 3. DXFOUT the new R13 drawing which now contains both $MODEL_SPACE
\ and *MODEL_SPACE.
\ 4. DXFIX this new R13 drawing and the old $MODEL_SPACE will be removed.
: delmodel ( ... n )
dup ( ... n n )
group? if ( ... n )
group ( ... addr1 )
"$MODEL_SPACE" ( ... addr1 addr2 )
strcmp ( ... flag )
0= if ( ... )
true delEndBlock !
clearitem writeitem drop
then
else ( ... n )
drop
then
;
: delpaper ( ... n )
dup ( ... n n )
group? if ( ... n )
group ( ... addr1 )
"$PAPER_SPACE" ( ... addr1 addr2 )
strcmp ( ... flag )
0= if ( ... )
true delEndBlock !
clearitem writeitem drop
then
else ( ... n )
drop
then
;
: starpaper ( ... n )
dup dup ( ... n n n )
group? if ( ... n n )
group ( ... n addr1 )
"*PAPER_SPACE" ( ... n addr1 addr2 )
strcmp ( ... n flag )
0= if ( ... n )
"$PAPER_SPACE" ( ... n addr3 )
swap ( ... addr3 n )
setgroup ( ... )
else ( ... n )
drop ( ... )
then
else ( ... n n )
drop drop ( ... )
then
;
: dxf:blocks:block
2 delmodel
3 delmodel
2 delpaper
3 delpaper
2 starmodel \ Change *MODEL_SPACE and *PAPER_SPACE
2 starpaper \ to $MODEL_SPACE and $PAPER_SPACE in
3 starpaper \ the 2 and 3 groups.
3 starmodel
;
\ Note, don't want to delete the 48 group from the TABLES section.
: dxf:blocks
0 group? if
removeUnknownEnts
0 group ( ... addr1 )
"ENDBLK" ( ... addr1 addr2 )
strcmp ( ... flag )
0= delEndBlock @ and if ( ... )
\ Delete the ENDBLK that corresponds to the PAPER/MODEL_SPACE
\ block just deleted.
false delEndBlock !
clearitem writeitem drop
then
then
48 delgroup
;
: dxf:entities
0 group? if
removeUnknownEnts
then
48 delgroup
;
: setHiLoRange
insideextents if
bignummean bignumlo 2!
else
bignummean bignumhi 2!
then
;
\ Add the offset from the origin.
: addOffset
10 group
2pointadd
;
\ Stack on entering: Stack on leaving:
: setExtents ( ... ) ( ... )
xMin 2@ 0 0 extentsMinSave element 2!
yMin 2@ 0 1 extentsMinSave element 2!
zMin 2@ 0 2 extentsMinSave element 2!
xMax 2@ 0 0 extentsMaxSave element 2!
yMax 2@ 0 1 extentsMaxSave element 2!
zMax 2@ 0 2 extentsMaxSave element 2!
10 group ( ... x y z )
\ Temporarily move the extents to include the origin of the RAY or XLINE.
2dup ( ... x y z z )
zMax 2@ ( ... x y z z zMax )
f> if ( ... x y z )
zMax 2! ( ... x y )
else ( ... x y z )
2dup ( ... x y z z )
zMin 2@ ( ... x y z z zMin )
f< if ( ... x y z )
zMin 2! ( ... x y )
else ( ... x y z )
2drop ( ... x y )
then
then
2dup ( ... x y y )
yMax 2@ ( ... x y y yMax )
f> if ( ... x y )
yMax 2! ( ... x )
else ( ... x y )
2dup ( ... x y y )
yMin 2@ ( ... x y y yMin )
f< if ( ... x y )
yMin 2! ( ... x )
else ( ... x y )
2drop ( ... x )
then
then
2dup ( ... x x )
xMax 2@ ( ... x x xMax )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -