Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f569cfc
feat(build): Add initial CMake build system and Fusion addin scaffold
BrandonPacewic Jul 16, 2025
0aae3f7
feat(context): add global context with Fusion app and UI setup
BrandonPacewic Jul 16, 2025
cb07387
feat(isotope): initial user facing extension
BrandonPacewic Jul 21, 2025
be496b7
deps(isotope): add protobuf cmake dep
BrandonPacewic Jul 22, 2025
0b10bd4
feat(isotope): material and component parsing
BrandonPacewic Jul 24, 2025
30722a4
fix(isotope): disable absl x86 flags
BrandonPacewic Jul 24, 2025
c695aef
feat(isotope): working joint parser
BrandonPacewic Jul 29, 2025
488b676
feat(isotope): proper joint motion and joint origin parsing
BrandonPacewic Aug 5, 2025
2f47933
fix(isotope): revert cmake build fix
BrandonPacewic Aug 5, 2025
2ce8d90
feat(isotope): add xcode build step for debugging
BrandonPacewic Aug 5, 2025
d93b754
feat(isotope): joint hierarchy parsing
BrandonPacewic Aug 5, 2025
e7c536c
feat(isotope): parse joint part hierarchy
BrandonPacewic Aug 16, 2025
bd89487
build(isotope): treat fus api as system interafce to avoid build warn…
BrandonPacewic Aug 16, 2025
902784a
chore(isotope): format with clang format
BrandonPacewic Aug 16, 2025
4d963be
feat(isotope): rigid group parsing
BrandonPacewic Aug 18, 2025
fc178ba
feat(isotope): enable world transform parsing
BrandonPacewic Aug 18, 2025
3a26134
fix(isotope): correctly handle guids
BrandonPacewic Aug 19, 2025
2612006
refactor(isotope): remove multiple namespaces
BrandonPacewic Aug 19, 2025
49f54cc
feat(isotope): unify component & occurrence guids
BrandonPacewic Aug 19, 2025
b19ae9f
fix(isotope): correct map constants for components and parts
BrandonPacewic Aug 20, 2025
0937bf6
feat(isotope): protobuf submodule build
BrandonPacewic Aug 20, 2025
ec3093f
feat(isotope): appearance & material property parsing
BrandonPacewic Aug 20, 2025
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "jolt"]
path = jolt
url = https://github.com/azaleacolburn/JoltPhysics.js.git
[submodule "protobuf"]
path = protobuf
url = https://github.com/protocolbuffers/protobuf.git
40 changes: 40 additions & 0 deletions isotope/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: Consecutive
AlignConsecutiveMacros: Consecutive
AlignEscapedNewlines: Left
AlignOperands: AlignAfterOperator
AlignTrailingComments:
Kind: Never
AllowShortFunctionsOnASingleLine: Empty
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBinaryOperators: NonAssignment
ColumnLimit: 120
IncludeIsMainRegex: ''
SortIncludes: true
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<(Fusion|Core)/'
Priority: 1
- Regex: '^<[^/]+>$'
Priority: 2
- Regex: '^<google/protobuf/'
Priority: 3
- Regex: '^(<|").*\.pb\.h[">]$'
Priority: 4
- Regex: '^"(?!.+\.pb\.h").*"$'
Priority: 5
- Regex: '.*'
Priority: 6
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: true
InsertBraces: true
InsertNewlineAtEOF: true
LineEnding: LF
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PointerAlignment: Left
SpaceAfterCStyleCast: true
SpaceBeforeParens: true
2 changes: 2 additions & 0 deletions isotope/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
compile_commands.json
build*
96 changes: 96 additions & 0 deletions isotope/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
cmake_minimum_required(VERSION 3.23)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

project(isotope LANGUAGES CXX)

if(NOT APPLE)
message(FATAL_ERROR "This project is only supported on macOS.")
endif()

set(USER_APP_DATA_DIR "$ENV{HOME}/Library/Application Support")
set(USER_APP_DATA_RELATIVE_PATH "Autodesk/Autodesk Fusion 360/API")
set(FUSION_API_DIR "${USER_APP_DATA_DIR}/${USER_APP_DATA_RELATIVE_PATH}")
set(FUSION_API_INCLUDE_DIR "${FUSION_API_DIR}/CPP/include")
set(FUSION_API_LIBRARY_DIR "${FUSION_API_DIR}/CPP/lib")
set(FUSION_API_VERSION_FILE "${FUSION_API_DIR}/version.txt")

set(FUSION_API_ADDINS_DIR "${FUSION_API_DIR}/Addins")
set(PROJECT_INSTALL_DIR "${FUSION_API_ADDINS_DIR}/${PROJECT_NAME}")

file(READ ${FUSION_API_VERSION_FILE} FUSION_API_VERSION)
message(STATUS "Fusion 360 API Version: ${FUSION_API_VERSION}")

set(FUSION_API_TARGET "fusion360")
set(FUSION_API_NAMESPACE "autodesk")
set(FUSION_API_LIBRARY_TARGETS "core" "fusion")

foreach(target IN LISTS FUSION_API_LIBRARY_TARGETS)
set(libpath "${FUSION_API_LIBRARY_DIR}/${target}${CMAKE_SHARED_LIBRARY_SUFFIX}")
add_library(${target} SHARED IMPORTED)
set_target_properties(${target} PROPERTIES IMPORTED_LOCATION ${libpath})
endforeach()

add_library(${FUSION_API_TARGET} INTERFACE)
add_library(${FUSION_API_NAMESPACE}::${FUSION_API_TARGET} ALIAS ${FUSION_API_TARGET})
target_include_directories(${FUSION_API_TARGET} SYSTEM INTERFACE ${FUSION_API_INCLUDE_DIR})
target_link_libraries(${FUSION_API_TARGET} INTERFACE ${FUSION_API_LIBRARY_TARGETS})

file(GLOB SOURCES "${CMAKE_CURRENT_LIST_DIR}/src/*.cpp")
add_library(${PROJECT_NAME} SHARED ${SOURCES})

set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
target_link_libraries(${PROJECT_NAME} PRIVATE ${FUSION_API_NAMESPACE}::${FUSION_API_TARGET})
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_LIST_DIR}/inc")

set(ABSL_PROPAGATE_CXX_STD ON)
set(protobuf_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(protobuf_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(protobuf_BUILD_CONFORMANCE OFF CACHE BOOL "" FORCE)
set(protobuf_INSTALL OFF CACHE BOOL "" FORCE)

set(GOOGLE_PROTOBUF_SUBMODULE_DIR "${CMAKE_CURRENT_LIST_DIR}/../protobuf")
if(NOT EXISTS "${GOOGLE_PROTOBUF_SUBMODULE_DIR}/.git")
message(FATAL_ERROR "google-protobuf is not checked out; make sure to run\n\tgit submodule update --init ../protobuf")
endif()

add_subdirectory(${GOOGLE_PROTOBUF_SUBMODULE_DIR} "${CMAKE_BINARY_DIR}/protobuf")

set(Protobuf_PROTOC_EXECUTABLE $<TARGET_FILE:protoc>)
target_link_libraries(${PROJECT_NAME} PRIVATE protobuf::libprotobuf)

set(PROTO_GEN_DIR "${CMAKE_CURRENT_BINARY_DIR}/protobuf_gen")
set(MIRABUF_SUBMODULE_DIR "${CMAKE_CURRENT_LIST_DIR}/../mirabuf")
file(MAKE_DIRECTORY ${PROTO_GEN_DIR})
file(GLOB PROTO_FILES "${MIRABUF_SUBMODULE_DIR}/*.proto")

set(PROTO_SRCS "")
set(PROTO_HDRS "")
foreach(_P IN LISTS PROTO_FILES)
get_filename_component(_NWE "${_P}" NAME_WE)
list(APPEND PROTO_SRCS "${PROTO_GEN_DIR}/${_NWE}.pb.cc")
list(APPEND PROTO_HDRS "${PROTO_GEN_DIR}/${_NWE}.pb.h")
endforeach()

add_custom_command(
OUTPUT ${PROTO_SRCS} ${PROTO_HDRS}
COMMAND ${Protobuf_PROTOC_EXECUTABLE}
--cpp_out=${PROTO_GEN_DIR}
-I ${MIRABUF_SUBMODULE_DIR}
${PROTO_FILES}
DEPENDS ${PROTO_FILES}
COMMENT "Generating protobuf sources"
)

add_custom_target(generate_protos ALL DEPENDS ${PROTO_SRCS} ${PROTO_HDRS})
add_dependencies(${PROJECT_NAME} generate_protos)
target_sources(${PROJECT_NAME}
PRIVATE
${PROTO_SRCS}
${PROTO_HDRS}
)
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${PROTO_GEN_DIR})

install(TARGETS ${PROJECT_NAME} DESTINATION ${PROJECT_INSTALL_DIR})
install(FILES "${CMAKE_CURRENT_LIST_DIR}/isotope.manifest" DESTINATION ${PROJECT_INSTALL_DIR})
install(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/resources/" DESTINATION "${PROJECT_INSTALL_DIR}/resources" FILES_MATCHING PATTERN "*.png")
48 changes: 48 additions & 0 deletions isotope/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
BUILD_DIR ?= build
XCODE_BUILD_DIR ?= build-xcode
CMAKE_GENERATOR ?= Unix Makefiles
BUILD_TYPE ?= Debug # Release | RelWithDebInfo ...
JOBS ?= $(shell nproc 2>/dev/null || sysctl -n hw.ncpu)

CMAKE_FLAGS = \
-G "$(CMAKE_GENERATOR)" \
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON

configure:
@mkdir -p "$(BUILD_DIR)"
@cmake -S . -B "$(BUILD_DIR)" $(CMAKE_FLAGS)
@ln -sf "$(BUILD_DIR)/compile_commands.json" .
@ln -sf "./isotope.manifest" "$(BUILD_DIR)"

build: configure
@cmake --build "$(BUILD_DIR)" -- -j$(JOBS)

build-xcode:
@mkdir -p "$(XCODE_BUILD_DIR)"
@cmake -G Xcode -S . -B "$(XCODE_BUILD_DIR)" -DCMAKE_BUILD_TYPE=Debug

open-xcode: build-xcode
@open build-xcode/isotope.xcodeproj

format:
@clang-format -i -style=file $(shell git ls-files '*.h' '*.cpp')

install: build
@cmake --install "$(BUILD_DIR)"

clean:
@rm -rf "$(BUILD_DIR)"
@rm -rf "$(XCODE_BUILD_DIR)"
@rm -f compile_commands.json

help:
@echo "Targets:"
@echo " configure - configure the project and generate the compilation rules json"
@echo " build - configure and build"
@echo " install - install the built project into your fusion instillation"
@echo " build-xcode - configure and build the xcode project for debugging"
@echo " open-xcode - open the built xcode project in xcode"
@echo " clean - remove build directory and prep for a fresh build"

.DEFAULT_GOAL := build
Empty file added isotope/README.md
Empty file.
20 changes: 20 additions & 0 deletions isotope/inc/components.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#pragma once
#include <Core/Memory.h>
#include <Fusion/Components/Component.h>
#ifndef ISOTOPE_COMPONENTS_H_
#define ISOTOPE_COMPONENTS_H_

#include <Core/CoreAll.h>
#include <Fusion/FusionAll.h>

#include "assembly.pb.h"
#include "types.pb.h"

mirabuf::Parts map_all_parts(const adsk::core::Ptr<adsk::fusion::Components>& components,
const mirabuf::material::Materials& materials); // TODO: Replace parameter with appearance map

mirabuf::Node parse_component_root(const adsk::core::Ptr<adsk::fusion::Component>& component, mirabuf::Parts* parts);

void map_rigid_groups(const adsk::core::Ptr<adsk::fusion::Component>& root, mirabuf::joint::Joints* joints);

#endif // ISOTOPE_COMPONENTS_H_
30 changes: 30 additions & 0 deletions isotope/inc/config_command.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#pragma once
#ifndef ISOTOPE_CONFIG_COMMAND_H_
#define ISOTOPE_CONFIG_COMMAND_H_

#include <Core/UserInterface/CommandCreatedEventHandler.h>
#include <Core/UserInterface/CommandEventHandler.h>

#include "context.h"

class ConfigureCommandCreatedHandler : public adsk::core::CommandCreatedEventHandler {
private:
const GlobalContext& gctx;

public:
ConfigureCommandCreatedHandler(const GlobalContext& context) : gctx(context) {}

void notify(const adsk::core::Ptr<adsk::core::CommandCreatedEventArgs>& args) override;
};

class ConfigureCommandExecutedHandler : public adsk::core::CommandEventHandler {
private:
const GlobalContext& gctx;

public:
ConfigureCommandExecutedHandler(const GlobalContext& context) : gctx(context) {}

void notify(const adsk::core::Ptr<adsk::core::CommandEventArgs>& eventArgs) override;
};

#endif // ISOTOPE_CONFIG_COMMAND_H_
17 changes: 17 additions & 0 deletions isotope/inc/context.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once
#ifndef ISOTOPE_CONTEXT_H_
#define ISOTOPE_CONTEXT_H_

#include <Core/Application/Application.h>
#include <Core/Memory.h>
#include <Core/UserInterface/UserInterface.h>

struct GlobalContext {
adsk::core::Ptr<adsk::core::Application> app;
adsk::core::Ptr<adsk::core::UserInterface> ui;

bool configure();
bool isValid() const;
};

#endif // ISOTOPE_CONTEXT_H_
19 changes: 19 additions & 0 deletions isotope/inc/joints.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once
#ifndef ISOTOPE_JOINTS_H_
#define ISOTOPE_JOINTS_H_

#include <Core/CoreAll.h>
#include <Fusion/FusionAll.h>

#include "joint.pb.h"
#include "signal.pb.h"
#include "types.pb.h"

std::pair<mirabuf::joint::Joints, mirabuf::signal::Signals> populate_joints(
const adsk::core::Ptr<adsk::fusion::Design>& design);

mirabuf::GraphContainer create_joint_graph(const mirabuf::joint::Joints& joints);

void build_joint_part_hierarchy(mirabuf::joint::Joints* joints, const adsk::core::Ptr<adsk::fusion::Design>& design);

#endif // ISOTOPE_JOINTS_H_
12 changes: 12 additions & 0 deletions isotope/inc/materials.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#pragma once
#ifndef ISOTOPE_MATERIALS_H_
#define ISOTOPE_MATERIALS_H_

#include <Core/CoreAll.h>

#include "material.pb.h"

mirabuf::material::Materials map_all_materials(const adsk::core::Ptr<adsk::core::Appearances>& design_appearances,
const adsk::core::Ptr<adsk::core::Materials>& design_materials);

#endif // ISOTOPE_MATERIALS_H_
9 changes: 9 additions & 0 deletions isotope/inc/parser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once
#ifndef ISOTOPE_PARSER_H_
#define ISOTOPE_PARSER_H_

#include "context.h"

void export_design(const GlobalContext& gctx);

#endif // ISOTOPE_PARSER_H_
Loading
Loading