feat: add OFFSET command with dynamic distance input and open polyline support#283
feat: add OFFSET command with dynamic distance input and open polyline support#283son-urban wants to merge 14 commits into
Conversation
… guard, closed polyline segment
- Remove dead code (rectangleDimensions, polarDistanceAngle) from AcEdInputManager - Remove AcApOffsetGeometry from public modify index - Echo state when Erase/Layer keywords are toggled - Add open polyline test coverage (2-vertex, 3-vertex, degenerate) - Fix duplicate i18n keys in offset section - Add trailing newline to offset.svg - Remove agent planning docs
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Note on ellipse offset limitationThe ellipse offset (
Without the axis direction, we cannot:
Fix needed in get majorAxis(): AcGeVector3d {
return this._geo.majorAxis
}Once that's available, both functions can be corrected. Happy to follow up in a separate PR once the getter is exposed. |
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
@son-urban The correct way is to add method getOffsetCurves in class AcDbCurve as what AutoCAD ObjectARX does.
There was a problem hiding this comment.
@son-urban You needs to change code in realdwg-web repo to add this method.
There was a problem hiding this comment.
@son-urban You should add one new class AcDbPromptDistanceOptions as the corresponding class in .NET
There was a problem hiding this comment.
Thanks, that makes sense. I’ll refactor toward this direction before marking the PR ready for review again.
|
@son-urban I added offset command in this PR. You can continue to refine offset command based on it if you are interested in it. For example, algorithm to compute offset for spline is still incorrect in certain case. |
…7.40 Replace standalone offset geometry functions with AcDbCurve#getOffsetSideAtPoint() and AcDbCurve#getOffsetCurves() from @mlightcad/data-model@1.7.40. Remove viewer-local AcApOffsetGeometry.ts + old tests. Bump deps, drop clipper2-ts. Add 58 unit tests covering all entity types and UX modes.
|
Closing this PR since mlightcad's OFFSET implementation (#290) has been merged into main. The refactor to use AcDbCurve.getOffsetCurves() is already covered there. Thanks! |
Summary
OFFSETcommand (AcApOffsetCmd) supporting Line, Arc, Circle, Ellipse, Polyline, and Spline entitiesE) and Layer (L) keyword toggles with status echoclipper2-ts) for closed polyline offsetInfrastructure changes
AcEdFloatingInput: newdistanceInputmode — shows a single floating input box that displays the perpendicular distance from cursor to the selected entity and accepts a typed overrideAcEdFloatingInputBox/Boxes/Types: extracted shared types and multi-box layout helpersAcEdPromptPointOptions: addeddistanceInputoption for distance-anchored point promptsosnapModes === 0(pre-existing bug fixed during this work)Test plan
pickSidenpx jest packages/cad-simple-viewer/__tests__/AcApOffsetGeometry.spec.tsNotes
OFFSETTABLE_TYPESfor axis-aligned cases which are the common case.null(not supported) — control points are not accessible via the public API.