Attach Drawing
attach_drawingGive a drawing (PDF, PNG or JPEG) to the part it belongs to, whatever the two files are called. Before a run: precheck_id from precheck_part and the row's component_key from get_precheck (or assembly, for the assembly's own drawing), with data_source_id of a drawing the precheck holds or the file as base64. The drawing goes with that part when upload_and_quote starts the precheck; attaching before the start is free and bills nothing. After a run: calculation_id of the part's own calculation (for an assembly, a component's) and the drawing. It becomes that part's drawing and, with run true (the default), the part is priced again as a new calculation, billable only if it succeeds; the same drawing again changes nothing. By default (apply=false) it only plans and attaches nothing; apply=true attaches. Returns where the precheck's drawings go, or the new calculation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| run | No | With calculation_id: price the part again with the drawing (default true; billable only if it succeeds). False attaches only. | |
| apply | No | False (the default): plan only, read the target and say what would change; nothing is attached. True: attach. | |
| precheck_id | No | Before the start: the precheck, as precheck_part returns it. With component_key; not with calculation_id. | |
| component_key | No | With precheck_id: the part the drawing belongs to, a row's component_key from get_precheck, or assembly for the assembly's own drawing. | |
| calculation_id | No | After a run: the calculation of the part, as upload_and_quote, quote_part or list_calculations return it (for an assembly, a component's own). Not with precheck_id. | |
| data_source_id | No | A drawing already stored: with precheck_id one the precheck holds (its drawings in get_precheck), with calculation_id a drawing of this organization that no unstarted precheck holds. Not with drawing_file_b64. | |
| drawing_file_b64 | No | The drawing itself, a PDF, PNG or JPEG as base64 (or a data: URI). With drawing_filename; not with data_source_id. | |
| drawing_filename | No | The file name of drawing_file_b64 with its extension, e.g. ZX-0001_A.pdf. | |
| drawing_content_type | No | MIME type of drawing_file_b64, when known. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | Yes | `precheck`: placed before the start. `calculation`: attached to a calculated part. | |
| applied | Yes | False: a plan only, nothing was attached. True: the drawing was attached. | |
| changed | No | False when this drawing already was the part's drawing: nothing was attached and nothing runs. | |
| drawings | No | Every drawing the precheck holds, and where each goes. | |
| revision | No | The precheck's revision, to start it with. | |
| next_step | Yes | What happens next. | |
| precheck_id | No | ||
| prices_again | No | For a calculated part: whether it is priced again — a new calculation, or a component's own in place. In a plan, what apply=true does. | |
| component_key | No | The part the drawing goes to on the precheck, or `assembly`. | |
| calculation_id | No | ||
| data_source_id | No | The drawing, as stored. | |
| precheck_status | No | The precheck's status: `received` while a new drawing's title block is read, `ready` once answered. | |
| new_calculation_id | No | The calculation that prices the part with this drawing, when run is true and the drawing changed. | |
| rerun_calculation_id | No | For a component of an assembly: its own calculation, priced again in place. | |
| new_calculation_status | No | Its status: `queued` is a run, `succeeded` an identical earlier run answering it unbilled, `blocked` a run held for quota. |