Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .fusion-addin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "FusionAddin",
"display_name": "Fusion Add-in Template",
"description": "A starter add-in for Autodesk Fusion by 4FusionLab.",
"initialized": false
"name": "InsertTo",
"display_name": "InsertTo",
"description": "Place SVG curves on a sketch plane or fit them to a linked frame with accurate dimensions and live preview.",
"initialized": true
}
4 changes: 2 additions & 2 deletions .github/release-paths.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Distribution inputs only; documentation, tests, CI and policy do not publish.
FusionAddin/**
# Only shipped add-in inputs may trigger an automatic GitHub Release.
InsertTo/**
scripts/build.py
.fusion-addin.json
68 changes: 0 additions & 68 deletions .github/workflows/initialize.yml

This file was deleted.

4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Read [4FusionLab shared engineering rules](https://github.com/4FusionLab/.github

## Working model

- This is an Autodesk Fusion Python add-in. The initial package is `FusionAddin/`; the initializer replaces its name and generates stable IDs.
- This is an Autodesk Fusion Python add-in. The initial package is `InsertTo/`; the initializer replaces its name and generates stable IDs.
- Discuss requirements and plans in Russian. Use clear English for Fusion commands, controls, diagnostics, and stable API names. Write documents in English and maintain separate Russian versions of documentation; intermediate working notes do not require translation.
- For README creation or edits, apply the [shared product README guidelines](https://github.com/4FusionLab/.github/blob/main/README_GUIDELINES.md). Check both languages, current release and license terms, and actual validation evidence before delivery.
- Treat the official Autodesk Fusion API documentation as the source of truth. Never invent SDK symbols; do not imply successful CAD acceptance based solely on offline CI.
- Put calculations and domain rules into `FusionAddin/core.py` or modules that **do not import adsk**. Fusion API interactions belong in adapters, event handlers and commands running in Fusion's permitted execution context.
- Put calculations and domain rules into `InsertTo/svg_geometry.py` or modules that **do not import adsk**. Fusion API interactions belong in adapters, event handlers and commands running in Fusion's permitted execution context.
- Design commands to be safe: validate active document, entities, units, parameters, and timeline state; use native previews where applicable. Never modify a user's CAD data during tests or without an explicit command action.
- Retain event handler instances while active; detach UI controls and command definitions in `stop(context)`. Keep identifiers stable after initial scaffolding. Avoid global state tied to stale documents.
- Add meaningful unit and offline integration tests. Test real Fusion flows on Windows/macOS separately when they matter; report what has and has not actually been verified.
Expand Down
4 changes: 2 additions & 2 deletions AGENTS.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

## Порядок работы

- Это аддон Autodesk Fusion на Python. Начальный пакет — `FusionAddin/`; инициализатор заменяет его имя и создаёт стабильные идентификаторы.
- Это аддон Autodesk Fusion на Python. Начальный пакет — `InsertTo/`; инициализатор заменяет его имя и создаёт стабильные идентификаторы.
- Обсуждайте требования и планы на русском. Для команд, элементов управления и диагностики Fusion и стабильных имён API используйте понятный английский. Документы ведите на английском, для документации поддерживайте отдельные русские версии; промежуточные рабочие заметки переводить не требуется.
- При создании или изменении README следуйте [общим правилам README продуктов](https://github.com/4FusionLab/.github/blob/main/README_GUIDELINES.md). До передачи проверяйте оба языка, действующий релиз и условия лицензии и фактические результаты проверок.
- Считайте официальную документацию Autodesk Fusion API источником истины. Никогда не выдумывайте символы SDK; успешный автономный CI сам по себе не означает приёмку CAD.
- Расчёты и предметные правила размещайте в `FusionAddin/core.py` или модулях, которые **не импортируют adsk**. Взаимодействия с Fusion API относятся к адаптерам, обработчикам событий и командам, выполняемым в разрешённом контексте Fusion.
- Расчёты и предметные правила размещайте в `InsertTo/svg_geometry.py` или модулях, которые **не импортируют adsk**. Взаимодействия с Fusion API относятся к адаптерам, обработчикам событий и командам, выполняемым в разрешённом контексте Fusion.
- Делайте команды безопасными: проверяйте активный документ, объекты, единицы, параметры и состояние таймлайна; используйте нативный предпросмотр, где применимо. Никогда не изменяйте CAD-данные пользователя в тестах или без явного действия командой.
- Сохраняйте экземпляры обработчиков событий на время работы; в `stop(context)` отсоединяйте элементы интерфейса и определения команд. После начального создания сохраняйте идентификаторы стабильными. Избегайте глобального состояния, связанного с устаревшими документами.
- Добавляйте значимые модульные и автономные интеграционные тесты. Когда это важно, отдельно проверяйте реальные сценарии Fusion на Windows/macOS; сообщайте, что фактически проверено, а что нет.
Expand Down
12 changes: 0 additions & 12 deletions FusionAddin/FusionAddin.manifest

This file was deleted.

110 changes: 0 additions & 110 deletions FusionAddin/FusionAddin.py

This file was deleted.

7 changes: 0 additions & 7 deletions FusionAddin/config.py

This file was deleted.

10 changes: 0 additions & 10 deletions FusionAddin/core.py

This file was deleted.

12 changes: 12 additions & 0 deletions InsertTo/InsertTo.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"autodeskProduct": "Fusion360",
"type": "addin",
"id": "d4f953a4-7cc6-4027-9699-dc025ebc8966",
"author": "Pavel Kuznetsov",
"description": {
"": "Place SVG curves on a sketch plane or fit them to a linked frame with accurate dimensions and live preview."
},
"version": "0.1.0",
"runOnStartup": true,
"supportedOS": "windows|mac"
}
80 changes: 80 additions & 0 deletions InsertTo/InsertTo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
"""Register Smart Insert in the sketch Insert menu."""

import traceback
from pathlib import Path

import adsk.core

from . import config, dialog, frame_link


_RESOURCES = Path(__file__).parent / 'resources'
_MENU_ID = '4FusionLab_InsertTo_SmartInsert'
_menu = None
_definition = None
_created = None
_sessions = []


class _Destroyed(adsk.core.CommandEventHandler):
def notify(self, args):
for session, handler in _sessions:
if handler is self:
session.close()
_sessions[:] = [pair for pair in _sessions if pair[1] is not self]


class _Created(adsk.core.CommandCreatedEventHandler):
def notify(self, args):
try:
session = dialog.attach(args.command)
destroyed = _Destroyed()
args.command.destroy.add(destroyed)
_sessions.append((session, destroyed))
except Exception:
app = adsk.core.Application.get()
app.log(traceback.format_exc())
app.userInterface.messageBox('Could not open Smart Insert. See the Fusion log for details.')


def run(context):
global _menu, _created, _definition
if _menu and _menu.isValid:
return

ui = adsk.core.Application.get().userInterface
workspace = ui.workspaces.itemById('FusionSolidEnvironment')
sketch_tab = workspace.toolbarTabs.itemById('SketchTab') if workspace else None
panel = sketch_tab.toolbarPanels.itemById('InsertPanel') if sketch_tab else None
if not panel:
raise RuntimeError('The sketch Insert panel is unavailable.')

try:
_definition = ui.commandDefinitions.addButtonDefinition(
config.COMMAND_ID, 'SVG', config.DESCRIPTION, str(_RESOURCES / 'svg')
)
_created = _Created()
_definition.commandCreated.add(_created)
_menu = panel.controls.addDropDown(
'Smart Insert', str(_RESOURCES / 'smart-insert'), _MENU_ID, 'SketchImportSVG', False
)
_menu.controls.addCommand(_definition)
frame_link.install(adsk.core.Application.get())
except Exception:
stop(context)
raise


def stop(context):
global _menu, _created, _definition
try:
frame_link.uninstall()
if _menu and _menu.isValid:
_menu.deleteMe()
if _definition and _definition.isValid:
_definition.deleteMe()
finally:
_menu = _created = _definition = None
for session, _ in _sessions:
session.close()
_sessions.clear()
File renamed without changes.
7 changes: 7 additions & 0 deletions InsertTo/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""Stable 4FusionLab project identifiers; do not change after release."""

ADDIN_NAME = 'InsertTo'
DISPLAY_NAME = 'InsertTo'
DESCRIPTION = 'Place SVG curves on a sketch plane or fit them to a linked frame with accurate dimensions and live preview.'
COMMAND_ID = '4FusionLab_InsertTo_77ac0485344b'
INITIALIZED = True
Loading
Loading