Code Monkey home page Code Monkey logo

bimodel_eg22's Introduction

Differentiable 3D CAD Programs for Bidirectional Editing

This repository contains the reference implementation of the paper "Differentiable 3D CAD Programs for Bidirectional Editing", conditionally accepted to Eurographics 2022.

Modern CAD tools represent 3D designs not only as geometry, but also as a program composed of geometric operations, each of which depends on a set of parameters. Program representations enable meaningful and controlled shape variations via parameter changes. However, achieving desired modifications solely through parameter editing is challenging when CAD models have not been explicitly authored to expose select degrees of freedom in advance.

We introduce a novel bidirectional editing system for 3D CAD programs. In addition to editing the CAD program, users can directly manipulate 3D geometry and our system infers parameter updates to keep both representations in sync.

We formulate inverse edits as a set of constrained optimization objectives, returning plausible updates to program parameters that both match user intent and maintain program validity. Our approach implements an automatically differentiable domain-specific language for CAD programs, providing derivatives for this optimization to be performed quickly on any expressed program.

Our system enables rapid, interactive exploration of a constrained 3D design space by allowing users to manipulate the program and geometry interchangeably during design iteration. While our approach is not designed to optimize across changes in geometric topology, we show it is expressive and performant enough for users to produce a diverse set of design variants, even when the CAD program contains a relatively large number of parameters.

Installation and Setup

Informally, the implementation is an extension meant to run in Blender. It uses a few external python dependencies (notably, Numpy, Scipy, and CFFI) in a Conda virtual environment. It has been built and tested with Blender 2.83 on Mac OS High Sierra and Catalina.

The addon can be imported to blender by importing __init__.py.

Detailed setup and dependency instructions coming soon.

Language

Please see the Language Reference

bimodel_eg22's People

Contributors

dcascaval avatar paquinn avatar

Stargazers

Guandao Yang avatar

Watchers

 avatar  avatar

Forkers

dcascaval

bimodel_eg22's Issues

Setup guide

Hi,

Thanks for the great work. I am trying to install the tool. This is the first time I install a plugin from source. I cannot get Blender 2.83 to use a conda virtual environment. So I installed the specificed packages in README as well as astunparse, sympy, pyperclip, libigl, Pillow with ./python3.7m -m pip install upon request. Then I put the source code in /Applications/Blender.app/Contents/Resources/2.83/scripts/addons/bimodel.

I get

  File "/Applications/Blender.app/Contents/Resources/2.83/scripts/addons/bimodel/__init__.py", line 2186, in compile_objectives
    with open("objectives_source.c","r") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'objectives_source.c'

I tried to give an absolute path of the file but get a C compile error.

Objectives not found, generating objectives
/Users/roden/objectives
generating /Users/roden/objectives.c
Found conda environment: /Applications/Blender.app/Contents
/Users/roden/objectives.c:50:14: fatal error: 'pyconfig.h' file not found
#    include <pyconfig.h>
             ^~~~~~~~~~~~
1 error generated.
clang: error: no such file or directory: '/Users/roden/objectives.o'
clang: error: no input files
Traceback (most recent call last):
  File "/Applications/Blender.app/Contents/Resources/2.83/scripts/addons/bimodel/__init__.py", line 2201, in Opt
    ob = crun.DyC("objectives")
  File "/Applications/Blender.app/Contents/Resources/2.83/scripts/addons/bimodel/crun.py", line 160, in __init__
    so = ctypes.PyDLL(f"{path}/{addon_name}/{name}.cpython-37m-darwin.so")
  File "/Applications/Blender.app/Contents/Resources/2.83/python/lib/python3.7/ctypes/__init__.py", line 364, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/roden/Library/Application Support/Blender/2.83/scripts/addons/bimodel/objectives.cpython-37m-darwin.so, 0x0006): tried: '/Users/roden/Library/Application Support/Blender/2.83/scripts/addons/bimodel/objectives.cpython-37m-darwin.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/roden/Library/Application Support/Blender/2.83/scripts/addons/bimodel/objectives.cpython-37m-darwin.so' (no such file), '/Users/roden/Library/Application Support/Blender/2.83/scripts/addons/bimodel/objectives.cpython-37m-darwin.so' (no such file)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Applications/Blender.app/Contents/Resources/2.83/scripts/modules/addon_utils.py", line 351, in enable
    mod = __import__(module_name)
  File "/Applications/Blender.app/Contents/Resources/2.83/scripts/addons/bimodel/__init__.py", line 2199, in <module>
    class Opt:
  File "/Applications/Blender.app/Contents/Resources/2.83/scripts/addons/bimodel/__init__.py", line 2204, in Opt
    compile_objectives()
  File "/Applications/Blender.app/Contents/Resources/2.83/scripts/addons/bimodel/__init__.py", line 2196, in compile_objectives
    crun.compiler("objectives", "\n".join(headers), bodies)
  File "/Applications/Blender.app/Contents/Resources/2.83/scripts/addons/bimodel/crun.py", line 118, in compiler
    raise Exception("Compile timed out [5 seconds]")
Exception: Compile timed out [5 seconds]

As the line it complains starts with # which should be in comment, I don't quite get what's going on. Could you please help with the setup and provide instruction for running a few examples as shown in the video?

Thanks,
Roden

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.