├── .gitignore
├── .github
└── acis_licensekey.jpg
├── .gitmodules
├── utilities
├── README.md
├── ACIS.supp
└── ACIS.natvis
├── 3rdparty
├── CMakeLists.txt
├── jsoncpp.cmake
└── jsoncpp
│ └── json
│ ├── json-forwards.h
│ └── json.h
├── cmake_uninstall.cmake.in
├── LICENSE
├── src
├── extract.h
├── common.h
├── ACIS.h
├── satgen.cpp
├── extract.cpp
├── common.cpp
└── sat2json.cpp
├── README.md
└── CMakeLists.txt
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/*
2 | .vscode/*
3 | build*/*
4 | *.sat
5 | *.err
6 |
--------------------------------------------------------------------------------
/.github/acis_licensekey.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/orbingol/rwsat/HEAD/.github/acis_licensekey.jpg
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "cmake-modules"]
2 | path = cmake-modules
3 | url = https://github.com/orbingol/cmake-modules.git
4 |
--------------------------------------------------------------------------------
/utilities/README.md:
--------------------------------------------------------------------------------
1 | * `ACIS.natvis`: ACIS NatVis file for Visual Studio
2 | * `ACIS.supp`: Valgrind suppression file for ACIS
3 |
--------------------------------------------------------------------------------
/3rdparty/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.11)
2 | project(RWSAT_THIRDPARTY)
3 |
4 | # Add jsoncpp
5 | include(jsoncpp.cmake)
6 |
--------------------------------------------------------------------------------
/3rdparty/jsoncpp.cmake:
--------------------------------------------------------------------------------
1 | # Include jsoncpp source
2 | set(JSONCPP_SRC
3 | ${CMAKE_CURRENT_LIST_DIR}/jsoncpp/jsoncpp.cpp
4 | ${CMAKE_CURRENT_LIST_DIR}/jsoncpp/json/json.h
5 | ${CMAKE_CURRENT_LIST_DIR}/jsoncpp/json/json-forwards.h
6 | )
7 |
8 | # Compile jsoncpp as a static library
9 | add_library(jsoncpp STATIC ${JSONCPP_SRC})
10 | target_include_directories(jsoncpp PUBLIC "${CMAKE_CURRENT_LIST_DIR}/jsoncpp")
11 |
--------------------------------------------------------------------------------
/utilities/ACIS.supp:
--------------------------------------------------------------------------------
1 | {
2 | SpaACIS-Param_flags
3 | Memcheck:Param
4 | rt_sigaction(act->sa_flags)
5 | ...
6 | obj:/opt/acis_r26sp1/linux_a64/code/bin/libSpaACIS.so
7 | }
8 | {
9 | SpaACIS-Param_mask
10 | Memcheck:Param
11 | rt_sigaction(act->sa_mask)
12 | ...
13 | obj:/opt/acis_r26sp1/linux_a64/code/bin/libSpaACIS.so
14 | }
15 | {
16 | SpaACIS-Cond
17 | Memcheck:Cond
18 | ...
19 | obj:/opt/acis_r26sp1/linux_a64/code/bin/libSpaACIS.so
20 | }
21 | {
22 | SpaACIS-Leak
23 | Memcheck:Leak
24 | ...
25 | obj:/opt/acis_r26sp1/linux_a64/code/bin/libSpaACIS.so
26 | }
27 |
--------------------------------------------------------------------------------
/utilities/ACIS.natvis:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | [{coord[0],g}, {coord[1],g}, {coord[2],g}]
9 |
10 | - coord[0]
11 | - coord[1]
12 | - coord[2]
13 |
14 |
15 |
16 | [{comp[0],g}, {comp[1],g}, {comp[2],g}]
17 |
18 | - comp[0]
19 | - comp[1]
20 | - comp[2]
21 |
22 |
23 |
24 | [{comp[0],g}, {comp[1],g}, {comp[2],g}]
25 |
26 | - comp[0]
27 | - comp[1]
28 | - comp[2]
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/cmake_uninstall.cmake.in:
--------------------------------------------------------------------------------
1 | # CMake uninstall target
2 | # https://gitlab.kitware.com/cmake/community/wikis/FAQ#can-i-do-make-uninstall-with-cmake
3 |
4 | if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
5 | message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
6 | endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
7 |
8 | file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
9 | string(REGEX REPLACE "\n" ";" files "${files}")
10 | foreach(file ${files})
11 | message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
12 | if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
13 | exec_program(
14 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
15 | OUTPUT_VARIABLE rm_out
16 | RETURN_VALUE rm_retval
17 | )
18 | if(NOT "${rm_retval}" STREQUAL 0)
19 | message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
20 | endif(NOT "${rm_retval}" STREQUAL 0)
21 | else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
22 | message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
23 | endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
24 | endforeach(file)
25 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2019, Integrated Design and Engineering Analysis Laboratory (IDEA Lab) at Iowa State University.
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 | * Redistributions of source code must retain the above copyright
7 | notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | * Neither the name of the copyright holder nor the
12 | names of its contributors may be used to endorse or promote products
13 | derived from this software without specific prior written permission.
14 |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 |
--------------------------------------------------------------------------------
/src/extract.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2019, Integrated Design and Engineering Analysis Laboratory (IDEA Lab) at Iowa State University.
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the copyright holder nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | #ifndef EXTRACT_H
29 | #define EXTRACT_H
30 |
31 | #include "common.h"
32 | #include "json/json.h"
33 |
34 |
35 | void extractSurfaceData(bs3_surface &, Config &, Json::Value &);
36 | void extractTrimCurveData(bs2_curve &, Config &, double *, double *, Json::Value &);
37 |
38 | #endif /* EXTRACT_H */
39 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # RWSAT - ACIS Extensions for NURBS-Python (geomdl)
2 |
3 | This repository contains the `rwsat` project and it contains 2 modules
4 |
5 | * `sat2json` for extracting spline geometries and trim curves from ACIS .SAT files
6 | * `satgen` for generating sample geometries to test `sat2json`
7 |
8 | The `rwsat` project is based on the work of [Dr. Adarsh Krishnamurthy](https://www.me.iastate.edu/faculty/profile/adarsh)
9 | with various improvements and new features.
10 |
11 | ## Requirements
12 |
13 | 1. [CMake](https://cmake.org)
14 | 2. [3D ACIS Modeler](https://www.spatial.com/)
15 |
16 | ## Compiling RWSAT
17 |
18 | 1. Clone the repository: `git clone https://github.com/orbingol/rwsat.git`
19 | 2. Enter the directory: `cd rwsat`
20 | 3. Update submodules: `git submodule update --init`
21 | 4. Use CMake to generate make files
22 | 5. Use `make install` to compile and install into the build directory
23 |
24 | ## Using RWSAT
25 |
26 | ### sat2json
27 |
28 | The simplest way to use `sat2json` is as follows:
29 |
30 | ```
31 | $ sat2json MODEL.sat licence_file=license.dat
32 | ```
33 |
34 | This command will convert `MODEL.sat` into a JSON file which is directly readable by
35 | [geomdl](https://github.com/orbingol/NURBS-Python) via `exchange.import_json` API call.
36 |
37 | The `license.dat` contains your **unlock_key** which can be found inside your license
38 | source file at the following location:
39 |
40 | 
41 |
42 | Run `sat2json` without any command-line arguments for more details on using the application.
43 |
44 | ### satgen
45 |
46 | The simplest way to use `satgen` is as follows:
47 |
48 | ```
49 | $ satgen SAMPLE.sat licence_file=license.dat
50 | ```
51 |
52 | The arguments are very similar to `sat2json` command. Please note that the `SAMPLE.sat` file
53 | is the output of the `satgen` command.
54 |
55 | ## Author
56 |
57 | * Onur Rauf Bingol ([@orbingol](https://github.com/orbingol))
58 |
59 | ## License
60 |
61 | * RWSAT is licensed under the terms of the [BSD 3-Clause License](LICENSE)
62 | * [JsonCpp](https://github.com/open-source-parsers/jsoncpp) is licensed under the terms of the [MIT License](https://github.com/open-source-parsers/jsoncpp/blob/master/LICENSE)
63 | * ACIS and SAT are registered trademarks of [Spatial Corporation](https://www.spatial.com/)
64 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.11)
2 | project(rwsat)
3 |
4 | # Extend CMake module path for loading custom modules
5 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake-modules")
6 |
7 | # Generate a Visual Studio filter "CMakePredefinedTargets"
8 | if(MSVC)
9 | set_property(GLOBAL PROPERTY USE_FOLDERS ON)
10 | set(PREDEFINED_TARGETS_FOLDER "CustomTargets")
11 | # Silence fopen warnings
12 | add_definitions(-D_CRT_SECURE_NO_WARNINGS)
13 | endif()
14 |
15 | # Set runtime path
16 | SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
17 |
18 | # Use C++11
19 | set(CMAKE_CXX_STANDARD 11)
20 |
21 | # Add 3rd party libraries
22 | add_subdirectory(3rdparty)
23 |
24 | # Set install directory
25 | set(RWSAT_INSTALL_DIR ${PROJECT_BINARY_DIR}/install CACHE PATH "Application install directory")
26 | set(CMAKE_INSTALL_PREFIX ${RWSAT_INSTALL_DIR})
27 |
28 | # Options
29 | set(RWSAT_BUILD_SATGEN OFF CACHE BOOL "Build and install satgen")
30 | set(RWSAT_INSTALL_DLL ON CACHE BOOL "Install SpaACIS.dll file alongside with the executables")
31 |
32 | # Find ACIS headers and libraries
33 | find_package(ACIS REQUIRED)
34 |
35 | # Include ACIS includes if ACIS is installed
36 | if(ACIS_FOUND)
37 | include_directories(${ACIS_INCLUDE_DIRS})
38 | else()
39 | message(FATAL_ERROR "ACIS not found")
40 | endif()
41 |
42 | # Set source files
43 | set(SOURCE_FILES_SAT2JSON
44 | src/ACIS.h
45 | src/common.h
46 | src/common.cpp
47 | src/extract.h
48 | src/extract.cpp
49 | src/sat2json.cpp
50 | )
51 |
52 | # Create the executable
53 | add_executable(sat2json ${SOURCE_FILES_SAT2JSON})
54 | target_link_libraries(sat2json jsoncpp ${ACIS_LINK_LIBRARIES})
55 | set_target_properties(sat2json PROPERTIES DEBUG_POSTFIX "d")
56 |
57 | # Install the binary
58 | install(
59 | TARGETS sat2json
60 | DESTINATION ${RWSAT_INSTALL_DIR}
61 | )
62 |
63 | if(RWSAT_BUILD_SATGEN)
64 | # Set source files for the generator application
65 | set(SOURCE_FILES_SATGEN
66 | src/ACIS.h
67 | src/common.h
68 | src/common.cpp
69 | src/satgen.cpp
70 | )
71 |
72 | # Create the executable for the generator application
73 | add_executable(satgen ${SOURCE_FILES_SATGEN})
74 | target_link_libraries(satgen ${ACIS_LINK_LIBRARIES})
75 | set_target_properties(satgen PROPERTIES DEBUG_POSTFIX "d")
76 |
77 | # Install the generator application
78 | install(
79 | TARGETS satgen
80 | DESTINATION ${RWSAT_INSTALL_DIR}
81 | )
82 | endif(RWSAT_BUILD_SATGEN)
83 |
84 | # On Windows, it would be wise copy required DLL files into the app directory
85 | if(MSVC AND ${RWSAT_INSTALL_DLL})
86 | install(
87 | FILES ${ACIS_REDIST_RELEASE}
88 | DESTINATION ${RWSAT_INSTALL_DIR}
89 | CONFIGURATIONS Release RelWithDebInfo MinSizeRel
90 | )
91 |
92 | install(
93 | FILES ${ACIS_REDIST_DEBUG}
94 | DESTINATION ${RWSAT_INSTALL_DIR}
95 | CONFIGURATIONS Debug
96 | )
97 | endif()
98 |
99 | # Create uninstall target
100 | if(NOT TARGET uninstall)
101 | configure_file(
102 | "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
103 | "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
104 | IMMEDIATE @ONLY)
105 |
106 | add_custom_target(uninstall
107 | COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
108 | endif()
109 |
--------------------------------------------------------------------------------
/src/common.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2019, Integrated Design and Engineering Analysis Laboratory (IDEA Lab) at Iowa State University.
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the copyright holder nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | #ifndef COMMON_H
29 | #define COMMON_H
30 |
31 | // C++ includes
32 | #include
33 | #include
34 | #include
35 | #include
36 | #include
37 | #include