Code Monkey home page Code Monkey logo

hellocontext's Introduction

HelloContext

This project is a proof of concept of using a library dependency to enable Fusion 360 Addin and Script development using a CMake build system. This enables support of development environments other than Visual Studio and Xcode, such as CLion.

Motivation

Upon the creation of a new script or add-in, Fusion 360 generates a template project with both a Visual Studio and XCode project file containing the relevant build settings. This unnecessarily complicates cross-platform C++ development and dependency management.

Solution

A straightforward solution is to support the CMake build system. Visual Studio already has built-in support for CMake and CMake can generate Xcode project files. CMake also has robust package management for including dependencies on other CMake projects.

Approach

Since Fusion 360 API does not have built-in support for the CMake package system, the approach this project takes is to use the MODULE signature of find_package() to import a versioned package of the Fusion 360 API.

Internally, the CMake module finds and links the headers and shared libraries into an interface library and derives the interface library version from the version.txt file specified in the Fusion 360 API directory. This enables the script or add-in to specify API version requirements, a future not currently not supported by AutoDesk.

Features

This project includes a derivation of the default project with the following differences:

  1. All the features previously described.
  2. Provides a CMake option to configure building for a script or add-in.
  3. Generates entry point source code based upon the build option. This is accomplished by configuring function macros inspired by Better Macros, Better Flags.
  4. Generates a .manifest JSON with project variables. This ensures that the manifest describing the project is consistent with source code.
  5. Configures the install destination for the script or add-in shared library and .manifest. This allowing seamless support of either cohabiting source and install targets (Fusion 360 default) or separation of the project directory from the Fusion 360 API directory. The later is especially attractive in the context of the build option previously described.
  6. Includes a dependency on JSON parsing library nlohmann json. This demonstrate the ease of integrating external libraries in script or add-in development.
  7. Entry points parse the context argument passed using the JSON parsing library. This provides an example for using external libraries to provide functionality not included in the Fusion 360 API.

hellocontext's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

hellocontext's Issues

Installation instructions?

Hello, first off thanks for publishing this started repo, it looks really promising for what I want to achieve.

I'm having a hard time getting Fusion 360 to launch the addin code created with this repo however.

I'm doing the following (with macos):

  1. clone repo
  2. mkdir build & cd build
  3. cmake .. && make

This succeeds:

HelloContext/build on  master [?] 
➜ cmake .. && make
-- Finding required library packages
-- The C compiler identification is AppleClang 15.0.0.15000040
-- The CXX compiler identification is AppleClang 15.0.0.15000040
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found nlohmann_json: /opt/homebrew/share/cmake/nlohmann_json/nlohmann_jsonConfig.cmake (found suitable version "3.11.2", minimum required is "3.2.0") 
-- Configuring .manifest file with project variables
-- Adding target shared library to project
-- Linking interface libraries to target shared library
-- Setting install location for library and manifest
-- Configuring done (1.5s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/zak/repos/open-source/HelloContext/build
[ 50%] Building CXX object CMakeFiles/HelloContext.dir/HelloContext.cpp.o
/Users/zak/repos/open-source/HelloContext/HelloContext.cpp:4:10: warning: non-portable path to file '<Cam/CamAll.h>'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#include <CAM/CAMAll.h>
         ^~~~~~~~~~~~~~
         <Cam/CamAll.h>
1 warning generated.
[100%] Linking CXX shared library HelloContext.dylib
[100%] Built target HelloContext

And I can see the addin built in Fusion 360 in the addins pane, so the manifest must be valid, however if I click run nothing appears to happen.

I'm not even sure where to go looking for error logs, any pointers would be amazing!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.