mirror of
https://github.com/storytold/cadcraft.git
synced 2026-12-02 02:38:30 -06:00
09f025ede3064a61ba96fa9a7cf736051a135d51
6
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
fc82a2f903 |
Dynamic blocks: base point and alignment parameters; lookups of angles, flips, XY distances and positions
- An action that moves a base point parameter moves the reference's insertion point with it and the block's objects and parameters back, as AutoCAD saves it. - Alignment parameters: type read, a grip at the base point; dragged next to an object the reference moves onto it and turns along it, its right side toward the cursor (measured in AutoCAD). - Lookup columns UpdatedAngle, UpdatedFlip, UpdatedDistanceX/Y, UpdatedX/Y (and polar distance and angle) set and read, including the reverse lookup; any changed parameter re-evaluates the lookups that read it. - A distance of 0 is taken, as AutoCAD takes it. - A first-time flip value is saved with its state after its points and the flip grip's record without a point; AutoCAD dropped the reference's dynamic properties otherwise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
fc8caca7b3 |
Dynamic blocks: polar stretch actions; scale by an XY parameter's diagonal
A polar stretch action turns its objects about the polar parameter's base by the change of its angle and moves the vertices in its frame (and the objects it doesn't stretch) with the end, as AutoCAD does; its rotate-only objects just turn. Parameters in its selection are carried. A scale action driven by an XY parameter scales uniformly by the parameter's diagonal, as AutoCAD does (the X-only and Y-only choices live only in DWG data that isn't read). Stretch and move actions on polar and XY parameters were checked against AutoCAD: they already match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
b471e5974a |
Dynamic blocks: scale actions
A scale action scales its objects about its base point by how much the distance it follows grew (an XY parameter's horizontal and vertical distances each on their own axis), as AutoCAD does, carrying the parameters in its selection. Factors that would scale to nothing or overflow are refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
46acac72eb |
Dynamic blocks: array actions, polar and XY parameters
A dynamic block reference now repeats its arrayed objects as AutoCAD does:
along a linear or polar parameter one copy per whole column offset in its
distance, across an XY parameter a whole number of columns by rows (just the
object when either is short of one), following the parameter's base point.
Copies after the first carry AutoCAD's AcDbBlockArrayActionTag; without it
AutoCAD can't change the reference again ("Invalid input").
Polar parameters show Distance1 and Angle1, XY parameters X Distance1 and
Y Distance1, in Properties (editable, value sets applied; an XY distance
below its minimum is refused as AutoCAD refuses it), with square grips at
the base and end and an XY parameter's two other corners.
Checked against AutoCAD with a linear, a polar and an XY array block: copy
counts and positions match for each value tried, AutoCAD reads CADCraft's
saved values and geometry, and changes them again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
ebeb263874 |
Dynamic blocks: rotation and flip grips, flip state after the points, tests
A rotation parameter's grip (a circle at the radius' end) turns the angle when dragged (a typed number sets it, in degrees); a flip grip (an arrow across the reflection line, placed from its grip object and turning with the line) flips at a click. A flip value record keeps its state after its points, also in a record CADCraft writes without a template. A synthetic Symbol fixture covers reading, turning, flipping, grips and bad values. Also: #967's test expectation counts positions from 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
48352f2baf |
Dynamic block grips: show and drag a dynamic reference's grips (stacked on #878) (#883)
* Dynamic blocks: read parameters and actions from AutoCAD files A dynamic block's evaluation graph (kept as foreign data since #528) is read into a typed model, `cadcraft_doc::dynblock`, without changing the kept data: parameters (linear with value sets, point, visibility states, lookup, base point; polar, XY, rotation, alignment and flip by geometry) and actions (stretch with its frame and moved vertices, lookup tables; move, scale, rotate, flip, array, polar stretch by kind), each with its graph id and the parameters it follows. - `blocks.dynamic {name}` returns the model as JSON (handles as hex); `blocks.list` marks dynamic blocks. - Counts and values come from the file: capped by the groups present, non-finite numbers and missing members skipped. - Tests: a synthetic DOOR block (visibility, linear list, stretch, lookup), its survival through a save, damaged data, and the engine commands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Dynamic block references: their values and custom properties A dynamic block reference's extension dictionary says which dynamic block it shows (AcDbBlockRepresentation ▸ AcDbRepData) and the values it was given (AppDataCache ▸ ACAD_ENHANCEDBLOCKDATA, one XRECORD per parameter graph id). `dynblock::reference` reads them; a reference to the dynamic block itself has the block's values. - `dynblock::custom_properties`: the Properties palette's Custom section, in parameter order, only parameters shown in Properties: visibility state, lookup value worked out from the lookup tables (their "no match" name, e.g. Custom, when the inputs match no row), distances and point positions in drawing units (block units × the reference's scale), with the choices of each (states, lookup values, a distance's list). - Properties: a dynamic block reference shows its dynamic block's name instead of its anonymous block's, and a read-only Custom section. - `blocks.reference {handle}` returns the definition, values and properties. - Tests: synthetic references (own values, an anonymous block scaled 2, a width no lookup row has), survival through a save, the engine command. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Dynamic block references: change the visibility state Choosing a visibility state (or a lookup value whose tables set only visibility states) in Properties ▸ Custom, or `blocks.reference.set {handle, name, value}`, changes a dynamic block reference as AutoCAD does: - The reference gets a new anonymous block: its current one with the state's objects shown and the parameter's other objects hidden (matched to the dynamic block's objects by their AcDbBlockRepETag element tags). The old anonymous block goes when nothing else uses it. - AutoCAD's link data is written: the new block's record carries AcDbBlockRepBTag (the dynamic block's record), copied objects keep their element tags, and the reference's AcDbBlockRepresentation data records the value (an existing value record is updated; a new one copies another reference's record for the same parameter when there is one). - An attribute whose definition the state hides is written hidden (60). - Changes CADCraft can't make yet (distances, positions, lookups that set them) are refused with a message and change nothing; Properties shows only what can change as a dropdown (`CustomProperty::editable`). - Tests: the synthetic DOOR references (own values and an anonymous block), survival through a save, refusals, and the engine command with undo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Dynamic block references: distances, positions, stretch and move actions, lookup chaining Linear distances (snapped to their value sets) and point positions can be changed; the stretch and move actions that follow them run (listed vertices or whole objects, multiplier and angle offset), parameters in an action's selection are carried along, associative hatches refill from their stretched outlines and the reference's attributes move with their definitions. Lookup tables run both ways (a changed input gives its table's lookup value, which sets the other tables' inputs). Connections are read in either group order. Checked against AutoCAD's own references (*U10, *U12). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Dynamic block references: record changes in the history as AutoCAD does; full value data for new references A changed reference's ACAD_ENHANCEDBLOCKHISTORY says what was done to it: a visibility state or lookup value by property name, a distance or position as the drag of its grips (GRIPLOC, how far each grip is from where the dynamic block has it). A reference that had no data gets a record for everything other references of the same dynamic block have, with its own values. Templates come only from references of the same dynamic block; anonymous copies have no units; boundary reactors follow the copies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Dynamic block history: record only the grips a change moves AutoCAD's history holds the user's own drags; a grip that only moved with another parameter (a stretch carrying it) gets no entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Dynamic block history: a distance by name, as typed in Properties AutoCAD records a distance typed in Properties as the parameter's name and value in block units (1071 id, 300 Distance2, 40 40.0), replacing drags of its grips; positions stay grip drags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * DWG: dynamic block lookup parameters keep their name and lookup action AutoCAD writes a lookup parameter's subclass marker as AcDbBlockLookUpParameter; the DWG bridge reads AcDbBlockLookupParameter and matches it exactly, so the parameter's name (303) and lookup action (94) were lost in DWG files and AutoCAD's lookups stopped working (a visibility change no longer resized the block). The bridge DXF now uses its spelling. Found by driving AutoCAD on CADCraft's output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Dynamic blocks: carried parameter points are in a stretch frame where the block has them AutoCAD evaluates actions from the dynamic block itself, so a parameter point another action has moved out of a stretch frame still follows it. Testing the current position instead changed a stretched label's width when its visibility changed (Distance2 183.75 became 184.45; AutoCAD keeps 183.75). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Dynamic block grips: show and drag a dynamic reference's grips as AutoCAD does A selected dynamic block reference shows its grips: an arrow at each end of a distance, a square at a position, a down-pointing triangle for a visibility or lookup list, only those its visibility state lists. Dragging an arrow changes the distance along the parameter (snapped to its values; a typed number sets it), a square moves the position, a list grip offers its choices; actions and lookups follow, with a live preview. doc: dynblock::grips, drag_grip; grip objects by graph id. engine: blocks.reference.grips, blocks.reference.grip, Session::start_dyn_grip. ui: canvas dynamic grips (GRIPDYNCOLOR-like token), list popup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Tests: read the shared DOOR fixture with LF line ends whatever the checkout gives Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Dynamic blocks: carried parameter points are in a stretch frame where the block has them AutoCAD evaluates actions from the dynamic block itself, so a parameter point another action has moved out of a stretch frame still follows it. Testing the current position instead changed a stretched label's width when its visibility changed (Distance2 183.75 became 184.45; AutoCAD keeps 183.75). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Dynamic grips: Ukrainian labels for the new commands; copy the hot grip instead of cloning Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Cody Vogt <18035288+codyvogt@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Brandon Thomas <echelon@gmail.com> |