非中心冲孔完成
This commit is contained in:
parent
4a3cfbe649
commit
73c42702d9
@ -191,7 +191,12 @@ namespace CadParamPluging.Cad.Drawers
|
||||
}
|
||||
|
||||
// 1.1 Centerline
|
||||
FeatureDrivenDrawer.DrawRingCenterline(ctx, ox, oy, W, H);
|
||||
// 改为竖直中心线,两头超出3mm
|
||||
var cx = ctx.Center.X;
|
||||
var vLine = new Line(new Point3d(cx, oy - 3, 0), new Point3d(cx, oy + H + 3, 0));
|
||||
ctx.Style?.Apply(vLine, DrawingStyleManager.Role.Centerline);
|
||||
ctx.Btr.AppendEntity(vLine);
|
||||
ctx.Tr.AddNewlyCreatedDBObject(vLine, true);
|
||||
|
||||
// 2. Outer Diameter Dimension
|
||||
var outerTolPlus = bag.GetDoubleOrNull(FeatureDrivenDrawer.KeyOuterDiameter1TolPlus);
|
||||
@ -205,22 +210,32 @@ namespace CadParamPluging.Cad.Drawers
|
||||
*/
|
||||
|
||||
// 5. Height Dimension
|
||||
var heightVal = bag.GetDoubleOrNull(FeatureDrivenDrawer.KeyHeight1) ?? H;
|
||||
var heightStr = bag.GetString(FeatureDrivenDrawer.KeyHeight1);
|
||||
var heightTolPlus = bag.GetDoubleOrNull(FeatureDrivenDrawer.KeyHeight1TolPlus);
|
||||
var heightTolMinus = bag.GetDoubleOrNull(FeatureDrivenDrawer.KeyHeight1TolMinus);
|
||||
var heightTolPlusStr = bag.GetString(FeatureDrivenDrawer.KeyHeight1TolPlus);
|
||||
var heightTolMinusStr = bag.GetString(FeatureDrivenDrawer.KeyHeight1TolMinus);
|
||||
|
||||
var heightBaseText = FeatureDrivenDrawer.BuildDimensionText(FeatureDrivenDrawer.FormatDimNumber(heightVal, heightStr), heightTolPlus, heightTolMinus, heightTolPlusStr, heightTolMinusStr);
|
||||
var heightDimText = heightPrime.HasValue && heightPrime.Value > 0
|
||||
? heightBaseText + $"\n({FeatureDrivenDrawer.FormatDimNumber(heightPrime.Value)})" // Use newline for alternate unit style if needed, or stick to \\X
|
||||
: heightBaseText;
|
||||
// Fix: Use OriginalBag for dimension text so it shows the real value (e.g. 43) not the scaled value (e.g. 12.28)
|
||||
var displayBag = ctx.OriginalBag ?? ctx.Bag;
|
||||
|
||||
// Fix: Use \\X for secondary text if using standard style
|
||||
if (heightPrime.HasValue && heightPrime.Value > 0)
|
||||
var displayHeightVal = displayBag.GetDoubleOrNull(FeatureDrivenDrawer.KeyHeight1) ?? H;
|
||||
var displayHeightStr = displayBag.GetString(FeatureDrivenDrawer.KeyHeight1);
|
||||
|
||||
var heightTolPlus = bag.GetDoubleOrNull(FeatureDrivenDrawer.KeyHeight1TolPlus); // Tolerances are usually absolute or percentage? Assuming absolute, they might need scaling or not?
|
||||
// Wait, if tolerances are absolute values in mm (like ±0.5), they should NOT be scaled in the text.
|
||||
// But they ARE scaled in the effective bag if they were in the sizeKeys list.
|
||||
// Let's check sizeKeys... Yes, TolPlus/TolMinus are in sizeKeys.
|
||||
// So if we used the scaled bag's tolerance for TEXT, it would be ±0.14. The screenshot shows ±0.1429. The User input is 0.5.
|
||||
// So we MUST use OriginalBag for Tolerances as well for the text.
|
||||
|
||||
var displayTolPlus = displayBag.GetDoubleOrNull(FeatureDrivenDrawer.KeyHeight1TolPlus);
|
||||
var displayTolMinus = displayBag.GetDoubleOrNull(FeatureDrivenDrawer.KeyHeight1TolMinus);
|
||||
var displayTolPlusStr = displayBag.GetString(FeatureDrivenDrawer.KeyHeight1TolPlus);
|
||||
var displayTolMinusStr = displayBag.GetString(FeatureDrivenDrawer.KeyHeight1TolMinus);
|
||||
|
||||
var displayHeightPrime = displayBag.GetDoubleOrNull(FeatureDrivenDrawer.KeyHeight1Prime);
|
||||
|
||||
var heightBaseText = FeatureDrivenDrawer.BuildDimensionText(FeatureDrivenDrawer.FormatDimNumber(displayHeightVal, displayHeightStr), displayTolPlus, displayTolMinus, displayTolPlusStr, displayTolMinusStr);
|
||||
var heightDimText = heightBaseText;
|
||||
|
||||
if (displayHeightPrime.HasValue && displayHeightPrime.Value > 0)
|
||||
{
|
||||
heightDimText = heightBaseText + $"\\X({FeatureDrivenDrawer.FormatDimNumber(heightPrime.Value)})";
|
||||
heightDimText = heightBaseText + $"\\X({FeatureDrivenDrawer.FormatDimNumber(displayHeightPrime.Value)})";
|
||||
}
|
||||
|
||||
// Custom Height Dimension Logic to ensure "Closed" look with fillets
|
||||
|
||||
Loading…
Reference in New Issue
Block a user