Skip to content

Commit

Permalink
Support trailing zeros control for dimension entities (part of DIMZIN)
Browse files Browse the repository at this point in the history
  • Loading branch information
zamtmn committed Oct 26, 2022
1 parent 5565f75 commit 3e26d50
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cad_source/zengine/core/entities/uzeentdimension.pas
Original file line number Diff line number Diff line change
Expand Up @@ -493,14 +493,14 @@ function GDBObjDimension.LinearFloatToStr(l:Double;var drawing:TDrawingDef):TDXF
var
ff:TzeUnitsFormat;
begin
ff:=drawing.GetUnitsFormat;
ff.RemoveTrailingZeros:=false;
ff.DeciminalSeparator:=PDimStyle.Units.DIMDSEP;
if PDimStyle.Units.DIMLUNIT<>DUSystem then
ff.uformat:=TLUnits(PDimStyle.Units.DIMLUNIT);
ff.umode:=UMWithSpaces;
ff.uprec:=TUPrec(PDimStyle.Units.DIMDEC);
result:=zeDimensionToUnicodeString(l,ff);
ff:=drawing.GetUnitsFormat;
ff.RemoveTrailingZeros:=(PDimStyle.Units.DIMZIN and 8)<>0;
ff.DeciminalSeparator:=PDimStyle.Units.DIMDSEP;
if PDimStyle.Units.DIMLUNIT<>DUSystem then
ff.uformat:=TLUnits(PDimStyle.Units.DIMLUNIT);
ff.umode:=UMWithSpaces;
ff.uprec:=TUPrec(PDimStyle.Units.DIMDEC);
result:=zeDimensionToUnicodeString(l,ff);
end;
function GDBObjDimension.GetLinearDimStr(l:Double;var drawing:TDrawingDef):TDXFEntsInternalStringType;
var
Expand Down
4 changes: 4 additions & 0 deletions cad_source/zengine/styles/uzestylesdim.pas
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ TGDBDimUnitsProp=record
DIMRND:Double;//Rounding value for dimension distances//group45
DIMPOST:AnsiString; //Dimension prefix<>suffix //group3
DIMSCALE:Double;//DIMSCALE//group40
DIMZIN:Integer;//Controls the suppression of zeros in the primary unit values//group78
end;
PPGDBDimStyleObjInsp=^PGDBDimStyleObjInsp;
PGDBDimStyleObjInsp=Pointer;
Expand Down Expand Up @@ -342,6 +343,8 @@ procedure GDBDimStyle.SetValueFromDxf(var mode:TDimStyleReadMode; group:Integer;
end;
end;
end;
78:
Units.DIMZIN:=strtoint(value);
144:
begin
Units.DIMLFAC:=strtofloat(value);
Expand Down Expand Up @@ -475,6 +478,7 @@ procedure GDBDimStyle.SetDefaultValues;
Units.DIMRND:=0;
Units.DIMDSEP:=DDSDot;
Units.DIMPOST:='';
Units.DIMZIN:=12;
Arrows.DIMASZ:=0.18;
text.DIMTXT:=0.18;
text.DIMTIH:=true;
Expand Down

0 comments on commit 3e26d50

Please sign in to comment.